home *** CD-ROM | disk | FTP | other *** search
/ 500 MB Nyheder Direkte fra Internet 2 / 500 MB nyheder direkte fra internet CD 2.iso / start / data / text / strange.txt < prev    next >
Text File  |  1994-09-21  |  165KB  |  3,263 lines

  1.  
  2.                                   CHARTS
  3.   You've already learned the most popular computer languages: 
  4. BASIC, DBASE, PASCAL, C, LOGO, FORTRAN, and COBOL.
  5.   But those seven languages are just the tip of the iceberg. 
  6. Programmers have invented thousands of others.
  7.   Here's a multilingual dictionary that lets you translate 15 
  8. languages. For example, it shows that BASIC says ``DIM X(4)'' but 
  9. FORTRAN says ``DIMENSION X(4)'' instead.
  10. ┌───────┬────────────────────────────────────────────────────────
  11. ───────────────────────────────────────────┐
  12. │BASIC  │DIM X(4)                 FOR I = 5 TO 17                                 
  13. GOSUB 1000   GO TO 50     │
  14. │FORTRAN│DIMENSION X(4)           DO 10 I=5,17                                    
  15. CALL JOE     GO TO 50     │
  16. │PL/I   │DECLARE X(4)             DO I = 5 TO 17                                  
  17. CALL JOE     GO TO GAIL   │
  18. │       │                                                                                                   
  19. │ALGOL  │REAL ARRAY X[1:4]        FOR I := 5 STEP 1 UNTIL 17 DO                   
  20. JOE          GO TO GAIL   │
  21. │PASCAL │X: ARRAY[1..4] OF REAL   FOR I := 5 TO 17 DO                             
  22. JOE          GOTO 50      │
  23. │MODULA │X: ARRAY[1..4] OF REAL   FOR I := 5 TO 17 DO                             
  24. JOE          not available│
  25. │ADA    │X: ARRAY(1..4) OF FLOAT  FOR I IN 5..17 LOOP                             
  26. JOE          GO TO GAIL   │
  27. │       │                                                                                                   
  28. │C      │FLOAT X[4]               FOR (I=5; I<=17; ++I)                           
  29. JOE()        GOTO GAIL    │
  30. │EASY   │PREPARE X(4)             LOOP I FROM 5 TO 17                             
  31. JOE          SKIP TO GAIL │
  32. │DBASE  │DECLARE X[4]             not available                                   
  33. DO JOE       not available│
  34. │COBOL  │X OCCURS 4 TIMES         PERFORM SAM VARYING I FROM 5 BY 
  35. 1 UNTIL I > 17  PERFORM JOE  GO TO GAIL   │
  36. │       │                                                                                                   
  37. │LOGO   │DEFAR "X 4 1             not available                                   
  38. JOE          GO "GAIL     │
  39. │LISP   │(ARRAY ((X (4) LIST)))   not available                                   
  40. (JOE)        (GO GAIL)    │
  41. │SNOBOL │X = ARRAY(4)             not available                                   
  42. JOE()        :(GAIL)      │
  43. │PILOT  │DIM:#X(4)                not available                                   
  44. U:JOE        J:*GAIL      │
  45. └───────┴────────────────────────────────────────────────────────
  46. ───────────────────────────────────────────┘
  47.  
  48. ┌───────┬────────────────────────────────────────────────────────
  49. ───────────────────────────────────────────┐
  50. │BASIC  │IF X=4.3 THEN         INPUT K           J=K+2                
  51. PRINT K           'SILLY STUFF        │
  52. │FORTRAN│IF (X .EQ. 4.3)       READ *, K         J=K+2                
  53. PRINT *, K        C  SILLY STUFF      │
  54. │PL/I   │IF X=4.3 THEN         GET LIST(K)       J=K+2                
  55. PUT LIST(K)       /* SILLY STUFF */   │
  56. │       │                                                                                                   
  57. │ALGOL  │IF X=4.3 THEN         READ(K)           J:=K+2               
  58. PRINT(K)          COMMENT  SILLY STUFF│
  59. │PASCAL │IF X=4.3 THEN         READ(K)           J:=K+2               
  60. WRITELN(K)        {SILLY STUFF}       │
  61. │MODULA │IF X=4.3 THEN         READINTEGER(K)    J:=K+2               
  62. WRITEINTEGER(K,6) (*SILLY STUFF*)     │
  63. │ADA    │IF X=4.3 THEN         GET(K)            J:=K+2               
  64. PUT(K)            --SILLY STUFF       │
  65. │       │                                                                                                   
  66. │C      │IF (X==4.3)           SCANF("%D,&K)     J=K+2                
  67. PRINTF("%D",K)    /* SILLY STUFF */   │
  68. │EASY   │IF X=4.3              GET K             LET J=K+2            
  69. SAY K             'SILLY STUFF        │
  70. │DBASE  │IF X=4.3              INPUT TO K        J=K+2                
  71. ? K               &&SILLY STUFF       │
  72. │COBOL  │IF X = 4.3            ACCEPT K          COMPUTE J = K + 
  73. 2    DISPLAY K         *SILLY STUFF        │
  74. │       │                                                                                                   
  75. │LOGO   │IF :X=4.3             MAKE "K READWORD  MAKE "J :K+2         
  76. PRINT :K          !SILLY STUFF        │
  77. │LISP   │(COND ((EQUAL X 4.3)  (SETQ K (READ))   (SETQ J (PLUS K 
  78. 2))  K                 ;SILLY STUFF        │
  79. │SNOBOL │EQ(X,4.3) :S(         K = INPUT         J = K + 2            
  80. OUTPUT = K        *SILLY STUFF        │
  81. │PILOT  │(#X=4.3)              A:#K              C:#J=#K+2            
  82. T:#K              R:SILLY STUFF       │
  83. └───────┴────────────────────────────────────────────────────────
  84. ───────────────────────────────────────────┘
  85.   The dictionary clumps the languages into groups. For example, 
  86. look at the languages in the second group: ALGOL, PASCAL, MODULA, 
  87. and ADA. Those four languages are almost identical to each other. 
  88. For example, in each of them you say ``J:=K+2''.
  89.   The bottom group (LOGO, LISP, SNOBOL, and PILOT) differs wildly 
  90. from the others. For example, look at how those four languages 
  91. translate ``IF X=4.3 THEN'' and ``J=K+2''. They're called radical 
  92. languages; the other eleven languages are called mainstream.
  93.   Two other radical languages are APL and FORTH. They're so weird 
  94. that they won't fit in the chart!
  95.   Here's how to make the computer do 2+2 and print the answer 
  96. (4), using each of those languages:
  97. BASIC and LOGO    EASY     DBASE  APL  LISP        FORTH    
  98. SNOBOL            ALGOL         PASCAL         ADA               
  99. PRINT 2+2         SAY 2+2  ? 2+2  2+2  (PLUS 2 2)  2 2 + .    
  100. OUTPUT = 2 + 2  BEGIN         BEGIN          PROCEDURE HARRY IS
  101.                                                             END               
  102. PRINT(2+2);   WRITELN(2+2);  BEGIN
  103.                                                                               
  104. END           END.           PUT(2+2);
  105.                                                                                                            
  106. END;
  107.  
  108. FORTRAN     PILOT     C                    PL/I                              
  109. MODULA                  COBOL                   
  110. N=2+2       C:#N=2+2  MAIN(){              HARRY:  PROCEDURE 
  111. OPTIONS(MAIN);  MODULE HARRY;           IDENTIFICATION DIVISION.
  112. PRINT *, N  T:#N        PRINTF("%D",2+2);          PUT LIST(2+2);              
  113. FROM INOUT            DATA DIVISION.
  114. END                     }                          END;                        
  115. IMPORT WRITEINTEGER;  WORKING-STORAGE SECTION.
  116.                                                                              
  117. BEGIN                   01     N PIC 9.
  118.                                                                              
  119. WRITEINTEGER(2+2,6);    PROCEDURE DIVISION.
  120.                                                                              
  121. END HARRY.              MAIN-ROUTINE.
  122.                                                                                                             
  123. ADD 2 2 GIVING N.
  124.                                                                                                             
  125. DISPLAY N.
  126.                                                                                                             
  127. STOP RUN.
  128.   Notice that APL's the briefest (just say 2+2), and COBOL's the 
  129. most verbose (it requires 9 lines of typing).
  130.   Each of those 17 languages is flexible enough to program 
  131. anything. Which language you choose is mainly a matter of 
  132. personal taste.
  133.   Other languages are more specialized. For example, a language 
  134. called ``GPSS'' is designed specifically to analyze how many 
  135. employees to hire, to save your customers from waiting in long 
  136. lines for service. DYNAMO analyzes social interactions inside 
  137. your company and city and throughout the world; then it graphs 
  138. your future. SPSS analyzes tables of numbers, by computing their 
  139. averages, maxima, minima, standard deviations, and hundreds of 
  140. other measurements used by statisticians. APT helps you run a 
  141. factory by controlling ``robots'' that cut metal. PROLOG lets you 
  142. store answers to your questions and act as an expert system. RPG 
  143. spits out long business reports for executives who don't have 
  144. enough time to program in COBOL.
  145.   The following table reveals more details about all those 
  146. languages. Within each category (``mainstream'', ``radical'', and 
  147. ``specialized''), the table lists the languages in chronological 
  148. order.
  149. Name  What the name stands forOriginal useVersion 1 arose 
  150. atWhenNames of new versions
  151.  
  152.       Mainstream languages
  153. FORTRANFORmula TRANslating  sciences  IBM           
  154. 1954-1957FORTRAN 90, Lahey FORTRAN
  155. ALGOL ALGOrithmic Language  sciences  international 
  156. 1957-1958ALGOL W, ALGOL 68, BALGOL
  157. COBOL COmmon Business-Oriented LanguagebusinessDefense 
  158. Department1959-1960                                       COBOL 
  159. 85
  160. BASIC Beginners All-purp. Symbolic Instruc. CodesciencesDartmouth 
  161. College                                             
  162. 1963-1964QBASIC, Visual BASIC
  163. PL/I  Programming Language Onegeneral IBM           1963-1966PL/I 
  164. Optimizer, PL/C, ANSI PL/I
  165. PASCALBlaise PASCAL         general   Switzerland   
  166. 1968-1970Turbo PASCAL, Quick PASCAL
  167. MODULAMODULAr programming   systems 
  168. program'ngSwitzerland1975MODULA-2
  169. C     C                     systems program'ngBell Telephone 
  170. Labs1970-1977                                             
  171. Microsoft C, Turbo C, C++
  172. ADA   ADA Lovelace          military equipmentFrance1977-1980ADA 
  173. final version
  174. DBASE Data BASE             database manage'ntJet Prop'n Lab & 
  175. Ashton-T.                                           
  176. 1978-1980DBASE 5, FOXPRO 2.6
  177. EASY  EASY                  general   Secret Guide  1972-1982EASY
  178.  
  179.       Radical languages
  180. LISP  LISt Processing       artificial 
  181. intelligenceMIT1958-1960Common LISP
  182. SNOBOLStriNg-Oriented symBOlic Languagestring processingBell 
  183. Telephone Labs                                      
  184. 1962-1963SNOBOL 4B
  185. APL   A Programming Languagesciences  Harvard & IBM 
  186. 1956-1966APLSV, APL PLUS
  187. LOGO  LOGO                  general   Bolt Beranek Newman1967LCSI 
  188. LOGO, LOGO Writer
  189. FORTH FOuRTH-generation languagebusin. & astronomyStanford Univ. 
  190. & Mohasco                                           
  191. 1963-1968FORTH83, FIG-FORTH, MMS F.
  192. PILOT Programmed Inquiry, Learning, Or Teachingtutoring kidsU. of 
  193. Cal. at San Francisco                               1968  Atari 
  194. PILOT
  195.  
  196.       Specialized languages
  197. APT   Automatically Programmed Toolscutting metalMIT1952-1957APT 
  198. 77
  199. DYNAMODYNAmic MOdels        simulationMIT           1959  DYNAMO 
  200. 3, STELLA
  201. GPSS  General-Purpose Simulation SystemsimulationIBM1961  GPSS 5
  202. RPG   Report Program GeneratorbusinessIBM           1964  RPG 3
  203. SPSS  Statistical Package for the Social 
  204. SciencesstatisticsStanford University               1965-1967SPSS 
  205. 5
  206. PROLOGPROgramming in LOGic  artificial 
  207. intelligenceFrance1972Arity PROLOG, Turbo PROLOG
  208.   Of those 23 languages, 5 were invented in Europe (ALGOL, 
  209. PASCAL, MODULA, ADA, and PROLOG). The others were invented in the 
  210. United States.
  211.   5 were invented at IBM's research facilities (FORTRAN, PL/I, 
  212. APL, GPSS, and RPG), 3 at MIT (LISP, APT, and DYNAMO), 2 at 
  213. Stanford University (FORTH and SPSS), 2 by Professor Niklaus 
  214. Wirth in Switzerland (PASCAL and MODULA), and 2 at Bell Telephone 
  215. Labs (C and SNOBOL). The others were invented by geniuses 
  216. elsewhere.
  217.  
  218.         MAINSTREAM LANGUAGES
  219.   The first mainstream languages were FORTRAN, ALGOL, and COBOL. 
  220. FORTRAN appealed to engineers, ALGOL to logicians, and COBOL to 
  221. business executives. FORTRAN was invented by IBM, ALGOL by an 
  222. international committee, and COBOL by a committee based at the 
  223. Pentagon.
  224.   The other mainstream languages, which came later, were just 
  225. slight improvements of FORTRAN, ALGOL, and COBOL.
  226.   For example, two professors at Dartmouth College combined 
  227. FORTRAN with ALGOL, to form BASIC. It was designed for students, 
  228. not professionals: it included just the easiest parts of FORTRAN 
  229. and ALGOL. Students liked it because it was easy to learn, but 
  230. professionals complained it lacked advanced features.
  231.   After inventing FORTRAN and further improvements (called 
  232. FORTRAN II, FORTRAN III, FORTRAN IV, and FORTRAN V), IBM decided 
  233. to invent the ``ultimate'' improvement: a language that would 
  234. include all the important words of FORTRAN V and ALGOL and COBOL. 
  235. At first, IBM called it ``FORTRAN VI''; but since it included the 
  236. best of everything and was the first complete language ever 
  237. invented, IBM changed its name to Programming Language One 
  238. (written as PL/I). IBM bragged about how PL/I was so eclectic, 
  239. but most programmers considered it a confusing mishmash and 
  240. continued using the original three languages (FORTRAN, ALGOL, and 
  241. COBOL), which were pure and simple.
  242.   Among the folks who disliked PL/I was Niklaus Wirth, who 
  243. preferred ALGOL. At a Swiss university, he invented an improved 
  244. ALGOL and called it PASCAL. Then he invented a further 
  245. improvement, called MODULA. ALGOL, PASCAL, and MODULA are all 
  246. very similar to each other. He thinks MODULA's the best of the 
  247. trio, but critics disagree. Today, PASCAL is still the most 
  248. popular; hardly anybody uses the original ALGOL anymore, and 
  249. MODULA is considered a controversial experiment.
  250.   While Wirth was developing and improving MODULA, other 
  251. researchers were developing four competitors: C, ADA, DBASE, and 
  252. EASY. Here's why.
  253.   Why C? Fancy languages, such as PL/I and MODULA, require lots 
  254. of RAM. At Bell Telephone Labs, researchers needed a language 
  255. small enough to fit in the tiny RAM of a minicomputer or 
  256. microcomputer. They developed the ideal tiny language and called 
  257. it C. Like PL/I, it borrows from FORTRAN, ALGOL, and COBOL; but 
  258. it lacks PL/I's frills. It's ``lean and mean'' and runs very 
  259. quickly.
  260.   Why ADA? The Department of Defense, which was happily using 
  261. COBOL to run the military's bureaucracy, needed to invent a 
  262. second kind of language, to control missiles and other military 
  263. equipment. The Department held a contest to develop such a 
  264. language and said it wanted the language to resemble PL/I, ALGOL, 
  265. and PASCAL. (It didn't know about MODULA, which was still being 
  266. developed.) The winner was a French company. The Department 
  267. adopted that company's language and called it ADA. It resembled 
  268. MODULA but included more commands ___ and therefore consumed more 
  269. RAM and was more expensive. Critics complain that ADA, like PL/I, 
  270. is too large and complex.
  271.                                          Why DBASE? Inspired by 
  272. languages such as BASIC and PL/I, Wayne Ratliff invented DBASE. 
  273. Like BASIC, DBASE is easy; like PL/I and PASCAL, DBASE creates 
  274. loops by saying WHILE instead of GO TO. What makes DBASE unique 
  275. is its new commands for manipulating databases. Of all the new 
  276. mainstream languages (C, ADA, DBASE, and EASY), DBASE has become 
  277. the greatest commercial success, and Wayne has become rich.
  278.                                          Why EASY? My own attempt 
  279. to create the ideal language is called EASY. It's even easier to 
  280. learn than BASIC, yet includes the power of languages such as 
  281. PASCAL. But since I don't have the time to put EASY onto a 
  282. computer, EASY's remained just an idea whose time should have 
  283. come.
  284.                                          Dig in! Here are the 
  285. inside secrets about all those mainstream languages. . . . 
  286.  
  287.                                                       FORTRAN
  288.                                          During the early 1950's, 
  289. the only available computer languages were specialized or 
  290. awkward. FORTRAN was the first computer language good enough to 
  291. be considered mainstream. ALGOL and COBOL came shortly 
  292. afterwards. FORTRAN, ALGOL, and COBOL were so good that they made 
  293. all earlier languages obsolete.
  294.                                          How FORTRAN developed In 
  295. 1954, an IBM committee said it was planning a new computer 
  296. language that would help engineers make the computer handle math 
  297. formulas. The committee called the language FORTRAN, to emphasize 
  298. that the language would be particularly good for TRANslating 
  299. FORmulas into computer notation.
  300.                                          Those original plans for 
  301. FORTRAN were modest. They did not allow long variable names, 
  302. subroutines, long function definitions, double precision, complex 
  303. numbers, or apostrophes.
  304.                                          According to the plans, 
  305. a variable's name had to be short: just two letters. A function's 
  306. definition had to fit on a single line. Instead of using 
  307. apostrophes and writing 'PLEASE KISS ME', the programmers had to 
  308. write 14HPLEASE KISS ME; the 14H meant a 14-character string.
  309.                                          The first working 
  310. version of FORTRAN (1957) allowed longer variable names: up to 6 
  311. characters. FORTRAN II (1958) allowed subroutines and long 
  312. function definitions. IBM experimented with FORTRAN III but never 
  313. released it to the public. FORTRAN IV (1962) allowed double 
  314. precision and complex numbers. Apostrophes around strings weren't 
  315. allowed until later.
  316.                                          The original plans said 
  317. you'd be able to add an integer to a real. That didn't work in 
  318. FORTRAN I, FORTRAN II, and FORTRAN IV, but it works today.
  319.                                          The original plans said 
  320. an IF statement would compare any two numbers. FORTRAN I and 
  321. FORTRAN II required the second number to be zero, but FORTRAN IV 
  322. removed that restriction.
  323.                                          IBM waged a campaign to 
  324. convince everyone that FORTRAN was easier than previous methods 
  325. of programming. IBM succeeded: FORTRAN became immediately 
  326. popular. FORTRAN was easy enough so that, for the first time, 
  327. engineers who weren't computer specialists could write programs.
  328.   Other manufacturers sold imitations of IBM's FORTRAN, but with 
  329. modifications. The variety of modifications from all the 
  330. manufacturers annoyed engineers, who wished manufacturers would 
  331. all use a single, common version of FORTRAN. So the engineers 
  332. turned to the American National Standards Institute (ANSI), which 
  333. is a non-profit group of engineers that sets standards. (``ANSI'' 
  334. is pronounced ``an see''. It sets standards for practically all 
  335. equipment in your life. For example, ANSI sets the standard for 
  336. screws: to tighten a screw, you turn it clockwise, not 
  337. counterclockwise.)
  338.   In 1966, ANSI decided on a single version of FORTRAN IV to be 
  339. used by all manufacturers. Thereafter, each manufacturer adhered 
  340. to the ANSI standard but also added extra commands, to try to 
  341. outclass the other manufacturers.
  342.   After several years had gone by, enough extra commands had been 
  343. added by manufacturers so engineers asked ANSI to meet again and 
  344. develop a common standard for those extras. ANSI finished 
  345. developing the standard in 1977 and called it FORTRAN 77.
  346.   Today, each major manufacturer adheres to the standard for 
  347. FORTRAN 77, so you can run FORTRAN 77 programs on most 
  348. maxicomputers, minicomputers, and microcomputers. Each 
  349. manufacturer adds extra commands beyond FORTRAN 77.
  350.   In 1984, an ANSI committee developed a ``FORTRAN 88''. 40 
  351. members of the committee approved it, but the other 2 members ___ 
  352. IBM and DEC ___ refused to endorse it. In 1991, a variant called 
  353. FORTRAN 90 was finally approved by all.
  354.   FORTRAN's popularity FORTRAN became popular immediately because 
  355. it didn't have any serious competitors. Throughout the 1960's and 
  356. 1970's, FORTRAN remained the most popular computer language among 
  357. engineers, scientists, mathematicians, and college students. 
  358. Colleges required all freshman computer-science majors to take 
  359. FORTRAN.
  360.   But at the end of the 1970's, FORTRAN's popularity began to 
  361. drop. Engineers switched to newer languages, such as BASIC (which 
  362. is easier), PASCAL (more logical), and C (faster and more 
  363. economical of RAM). Although FORTRAN 77 included extra commands 
  364. to make FORTRAN resemble BASIC and PASCAL, those commands were 
  365. ``too little, too late'': FORTRAN's new string commands weren't 
  366. quite as good as BASIC's, and FORTRAN's new IF command wasn't 
  367. quite as good as PASCAL's.
  368.   Now high-school kids are required to study BASIC, college kids 
  369. are required to study PASCAL, professional programmers are 
  370. required to study C, and hardly anybody studies FORTRAN. People 
  371. who still program in FORTRAN are called ``old-fashioned'' by 
  372. their colleagues.
  373.   But in some ways, FORTRAN's still better for engineering that 
  374. BASIC, PASCAL, or C. For example, FORTRAN includes more commands 
  375. for handling ``complex numbers''. FORTRAN programmers have 
  376. developed libraries containing thousands of FORTRAN subroutines, 
  377. which you can use in your own FORTRAN programs; such large 
  378. libraries haven't been developed for BASIC, PASCAL, or C yet.
  379.   Although BASIC, PASCAL, and C work well on microcomputers and 
  380. minicomputers, no good versions of those languages have been 
  381. invented for IBM maxicomputers yet. The only language that lets 
  382. you unleash an IBM maxicomputer's full power to solve engineering 
  383. problems is FORTRAN.
  384.                                                        ALGOL
  385.                                          In 1955, a committee in 
  386. Germany began inventing a computer language. Though the committee 
  387. spoke German, it decided the computer language should use English 
  388. words instead, since English was the international language for 
  389. science.
  390.                                          In 1957 those Germans 
  391. invited Americans to join them. In 1958 other European countries 
  392. joined also, to form an international committee, which proposed a 
  393. new computer language, called ``IAL'' (International Algebraic 
  394. Language).
  395.                                          The committee eventually 
  396. changed the language's name to ALGOL 58 (the ALGOrithmic Language 
  397. invented in 1958), then created an improved version called ALGOL 
  398. 60, then created a further revision called ALGOL 60 Revised, and 
  399. disbanded. Today, programmers who mention ``ALGOL'' usually mean 
  400. the committee's last report, ALGOL 60 Revised.
  401.                                          ALGOL differs from 
  402. FORTRAN in many little ways. . . .
  403.                                          How to end a statement 
  404. At the end of each statement, FORTRAN requires you to press the 
  405. ENTER key. ALGOL requires you to type a semicolon instead.
  406.                                          ALGOL's advantage: you 
  407. can type many statements on the same line, by putting semicolons 
  408. between the statements. ALGOL's disadvantage: those ugly 
  409. semicolons are a nuisance to type and make your program look 
  410. cluttered.
  411.                                          Integer variables To 
  412. tell the computer that a person's AGE is an integer (instead of a 
  413. real number), FORTRAN requires you to put the letter I, J, K, L, 
  414. M, or N before the variable's name, like this: IAGE. ALGOL 
  415. requires you to insert a note saying ``INTEGER AGE'' at the top 
  416. of your program instead.
  417.                                          ALGOL's advantage: you 
  418. don't have to write unpronounceable gobbledygook such as 
  419. ``IAGE''. ALGOL's disadvantage: whenever you create a new 
  420. variable, ALGOL forces you to go back up to the top of your 
  421. program and insert a line saying ``INTEGER'' or ``REAL''.
  422.                                          Assignment statements In 
  423. FORTRAN, you can say J=7. In ALGOL, you must insert a colon and 
  424. say J:=7 instead.
  425.                                          To increase K by 1 in 
  426. FORTRAN, you say K=K+1. In ALGOL, you say K:=K+1.
  427.                                          ALGOL's disadvantage: 
  428. the colon is a nuisance to type. FORTRAN's disadvantage: 
  429. according to the rules of algebra, it's impossible for K to equal 
  430. K+1, and so the FORTRAN command K=K+1 looks like an 
  431. impossibility.
  432.                                          ALGOL's beauty ALGOL 
  433. avoids FORTRAN's ugliness, in the following ways. . . . 
  434.                                          In ALGOL, a variable's 
  435. name can be practically as long as you like. In FORTRAN, a 
  436. variable's name must be short: no more than 6 characters.
  437.                                          ALGOL lets you write 2 
  438. instead of 2.0, without affecting the computer's answer. In 
  439. FORTRAN, if you write 1/2 instead of 1/2.0, you get 0 instead of 
  440. .5; and if you write SQRT (9) instead of SQRT (9.0), you get 
  441. nonsense.
  442.                                          ALGOL's IF statement is 
  443. very flexible: it can include the words ELSE, BEGIN, and END, and 
  444. it lets you insert as many statements as you want between BEGIN 
  445. and END. ALGOL even lets you put an IF statement in the middle of 
  446. an equation, like this: X:=2+(IF Y<5 THEN 8 ELSE 9). The IF 
  447. statement in FORTRAN I, II, III, and IV was very limited; the IF 
  448. statement in FORTRAN 77 copies some of ALGOL's power, but not yet 
  449. all.
  450.   ALGOL's FOR statement is very flexible. To make X be 3.7, then 
  451. be Y+6.2, then go from SQRT(Z) down to 5 in steps of .3, you can 
  452. say ``FOR X:=3.7, Y+6.2, SQRT(Z) STEP -.3 UNTIL 5 DO''. FORTRAN's 
  453. DO is more restrictive; some versions of FORTRAN even insist that 
  454. the DO statement must not contain reals, must not contain 
  455. negatives, and must not contain arithmetic operations.
  456.   At the beginning of a FORTRAN program, you can say DIMENSION 
  457. X(20) but not DIMENSION X(N). ALGOL permits the ``DIMENSION 
  458. X(N)'' concept; in ALGOL you say ARRAY X[1:N].
  459.   ALGOL's popularity When ALGOL was invented, programmers loved 
  460. it. Europeans began using ALGOL more than FORTRAN. The American 
  461. computer association (called the Association for Computing 
  462. Machinery, ACM) said all programs in its magazine would be in 
  463. ALGOL.
  464.   But IBM refused to put ALGOL on its computers. Since most 
  465. American programmers used IBM computers, most American 
  466. programmers couldn't use ALGOL. That created a ridiculous 
  467. situation: American programmers programmed in FORTRAN instead, 
  468. but submitted ALGOL translations to the ACM's magazine, which 
  469. published the programs in ALGOL, which the magazine's readers had 
  470. to translate back to FORTRAN in order to run on IBM computers.
  471.   IBM computers eventually swept over Europe, so that even 
  472. Europeans had to use FORTRAN instead of ALGOL.
  473.   In 1966 the ACM gave in and agreed to publish programs in 
  474. FORTRAN. But since ALGOL was prettier, everybody continued to 
  475. submit ALGOL versions anyway.
  476.   IBM gave in also and put ALGOL on its computers. But IBM's 
  477. version of ALGOL was so limited and awkward that nobody took it 
  478. seriously, and IBM stopped selling it and supporting it.
  479.   In 1972 Stanford University created ALGOL W, a better version 
  480. that ran on IBM computers. But ALGOL W came too late: 
  481. universities and businessmen had already grown tired of waiting 
  482. for a good IBM ALGOL and had committed themselves to FORTRAN.
  483.   Critics blamed IBM for ALGOL's demise. But here's IBM's side of 
  484. the story. . . . 
  485.   IBM had invested 25 man-years to develop the first version of 
  486. FORTRAN. By the time the ALGOL committee finished the report on 
  487. ALGOL 60 Revised, IBM had also developed FORTRAN II and FORTRAN 
  488. III and made plans for FORTRAN IV. IBM was proud of its FORTRANs 
  489. and wanted to elaborate on them.
  490.   Moreover, IBM realized that computers run FORTRAN  programs 
  491. more quickly than ALGOL.
  492.   When asked why it didn't support ALGOL, IBM replied that the 
  493. committee's description of ALGOL was incomplete. IBM was right; 
  494. the ALGOL 60 Revised Report has three loopholes:
  495.   1. The report doesn't say what words to use for input and 
  496. output, because the committee couldn't agree. So computers 
  497. differ. If you want to transfer an ALGOL program from one 
  498. computer to another, you must change all the input and output 
  499. instructions.
  500.   2. The report uses symbols such as ÷ and ■, which aren't on 
  501. most keyboards. The report underlines keywords; most keyboards 
  502. can't underline. To type ALGOL programs on a typical keyboard, 
  503. you must substitute other symbols for ÷, ■, and underlining. Here 
  504. again, manufacturers differ. To transfer an ALGOL program to 
  505. another manufacturer, you must change symbols.
  506.                                          3. Some features of 
  507. ALGOL are hard to teach to a computer. Even today, no computer 
  508. understands all of ALGOL. When a manufacturer says its computer 
  509. ``understands ALGOL'', you must ask, ``Which features of ALGOL?''
  510.                                          Attempts to improve 
  511. ALGOL Long after the original ALGOL committee wrote the ALGOL 60 
  512. Revised Report, two other ALGOL committees were formed.
  513.                                          One committee developed 
  514. suggestions on how to do input and output, but its suggestions 
  515. were largely ignored.
  516.                                          The other committee 
  517. tried to invent a much fancier ALGOL. That committee wrote its 
  518. preliminary report in 1968 and revised it in 1975. Called ALGOL 
  519. 68 Revised, that weird report requires you to spell words 
  520. backwards: to mark the end of the IF statement, you say FI; to 
  521. mark the end of the DO statement, you say OD. The committee's 
  522. decision was far from unanimous: several members refused to 
  523. endorse the report.
  524.                                          ALGOL today Few 
  525. programmers still use ALGOL, but many use PASCAL (which is very 
  526. similar to ALGOL 60 Revised) and BASIC (which is a compromise 
  527. between ALGOL and FORTRAN).
  528.  
  529.                                                        COBOL
  530.                                          During the 1950's, 
  531. several organizations developed languages to solve problems in 
  532. business. The most popular business languages were IBM's 
  533. COMMERCIAL TRANSLATOR (developed from 1957-1959), Honeywell's 
  534. FACT (1959-1960), Sperry Rand's FLOW-MATIC (1954-1958), and the 
  535. Air Force's AIMACO (1958).
  536.                                          In April 1959, a group 
  537. of programmers and manufacturers met at the University of 
  538. Pennsylvania and decided to develop a single business language 
  539. for all computers. The group asked the Department of Defense to 
  540. help sponsor the research.
  541.                                          The Department agreed, 
  542. and so a follow-up meeting was held at the Pentagon in May. At 
  543. that meeting, the group tentatively decided to call the new 
  544. language ``CBL'' (for ``Common Business Language'') and created 
  545. three committees.
  546.                                          The Short-Range 
  547. Committee would meet immediately to develop a temporary language. 
  548. A Medium-Range Committee would meet later to develop a more 
  549. thoroughly thought-out language. Then a Long-Range Committee 
  550. would develop the ultimate language.
  551.                                          The Short-Range 
  552. Committee met immediately and created a language nice enough so 
  553. that the Medium-Range and Long-Range Committees never bothered to 
  554. meet.
  555.                                          The Short-Range 
  556. Committee wanted a more pronounceable name for the language than 
  557. ``CBL''. At a meeting in September 1969, the committee members 
  558. proposed six names: ``BUSY'' (BUsiness SYstem), ``BUSYL'' 
  559. (BUsiness SYstem Language), ``INFOSYL'' (INFOrmation SYstem 
  560. Language), ``DATASYL'' (DATA SYstem Language), ``COSYL'' (COmmon 
  561. SYstem Language), and ``COCOSYL'' (COmmon COmputer SYstem 
  562. Language). The next day, a member of the committee suggested 
  563. ``COBOL'' (COmmon Business-Oriented Language), and the rest of 
  564. the committee agreed.
  565.                                          I wish they'd have kept 
  566. the name ``BUSY'', because it's easier to pronounce and remember 
  567. than ``COBOL''. Today, COBOL programmers are still known as 
  568. ``BUSY bodies''.
  569.   From Sperry Rand's FLOW-MATIC, the new language (called 
  570. ``COBOL'') borrowed two rules: begin each statement with an 
  571. English verb, and put data descriptions in a different program 
  572. division than procedures. From IBM's COMMERCIAL TRANSLATOR, COBOL 
  573. borrowed group items (01 and 02), PICTURE symbols, fancy IF 
  574. statements, and COMPUTE formulas.
  575.   Compromises On some issues, the members of the committee 
  576. couldn't agree, and so they had to compromise.
  577.   For example, some members wanted COBOL to let the programmers 
  578. construct mathematical formulas by using these symbols:
  579. +     -     *     /     =     (     )
  580. But other members of the committee disagreed: they argued that 
  581. since COBOL is supposed to be for stupid businessmen who fear 
  582. formulas, COBOL ought to use the words ADD, SUBTRACT, MULTIPLY, 
  583. and DIVIDE instead. The committee compromised: when you write a 
  584. COBOL program, you can use the words ADD, SUBTRACT, MULTIPLY, and 
  585. DIVIDE; if you prefer, you can use a formula instead, but you 
  586. must warn the computer by putting the word COMPUTE in front of 
  587. the formula.
  588.   COBOL can handle short numbers. Can it handle long numbers 
  589. also? How long? How many digits? The committee decided that COBOL 
  590. would handle any number up to 18 digits long. The committee also 
  591. decided that COBOL would handle any variable name up to 30 
  592. characters long. So the limits of COBOL are ``18 and 30''. Why 
  593. did the committee pick those two numbers ___ ``18 and 30'' ___ 
  594. instead of ``16 and 32''? Answer: some manufacturers wanted ``16 
  595. and 32'' (because their computers were based on the numbers 16 
  596. and 32), but other manufacturers wanted other combinations (such 
  597. as ``24 and 236''); the committee, hunting for a compromise, 
  598. chose ``18 and 30'', because nobody wanted it, and so it would 
  599. give no manufacturer an unfair advantage over competitors. In 
  600. other words, COBOL was designed to be equally terrible for 
  601. everybody! That's politics!
  602.   COBOL's popularity In 1960, the Department of Defense announced 
  603. it would buy only computers that understand COBOL, unless a 
  604. manufacturer can demonstrate why COBOL would not be helpful. In 
  605. 1961, Westinghouse Electric Corp. made a similar announcement. 
  606. Other companies followed. COBOL became the most popular computer 
  607. language. Today it's still the most popular computer language for 
  608. maxicomputers, though programmers on minicomputers and 
  609. microcomputers have switched to newer languages.
  610.   Improvements The original version of COBOL was finished in 1960 
  611. and called COBOL 60. Then came an improvement, called COBOL 61. 
  612. The verb SORT and a ``Report Writer'' feature were added in 1962. 
  613. Then came COBOL 65, COBOL 68, COBOL 74, AND COBOL 85.
  614.   COBOL's most obvious flaw To write a COBOL program, you must 
  615. put information about file labeling into the data division's FD 
  616. command. Since file labeling describes the environment, not the 
  617. data, COBOL should be changed, to put the labeling in the 
  618. environment division instead. Jean Sammet, who headed some of the 
  619. Short-Term Committee's subcommittees, admits her group goofed 
  620. when it decided to put labeling in the data division. But alas, 
  621. COBOL's too old to change now.
  622.                                                        BASIC
  623.                                          The first version of 
  624. BASIC was developed in 1963 and 1964 by a genius (John Kemeny) 
  625. and his friend (Tom Kurtz).
  626.                                          How the genius grew up 
  627. John Kemeny is a Jew who was born in Hungary in 1926. In 1940 he 
  628. and his parents fled from the Nazis and came to America. Although 
  629. he knew hardly any English when he began high school in New York, 
  630. he learned enough so that he graduated as the top student in the 
  631. class. Four years later, he graduated from Princeton summa cum 
  632. laude even though he had to spend 1½ of those years in the Army, 
  633. where he helped solve equations for the atomic bomb.
  634.                                          Two years after his 
  635. B.A., Princeton gave him a Ph.D. in mathematics and philosophy, 
  636. because his thesis on symbolic logic combined both fields.
  637.                                          While working for the 
  638. Ph.D., he was also Einstein's youngest assistant. He told 
  639. Einstein he wanted to quit math and instead hand out leaflets for 
  640. world peace. Einstein replied: handing out leaflets would waste 
  641. his talents; the best way for him to help world peace would be to 
  642. become a famous mathematician, so people would listen to him, as 
  643. they had to Einstein. He took Einstein's advice and stayed with 
  644. math.
  645.                                          After getting his Ph.D., 
  646. he taught symbolic logic in Princeton's philosophy department. In 
  647. 1953, most of Dartmouth College's math professors were retiring, 
  648. so Dartmouth asked Kemeny to come to Dartmouth, chair the 
  649. department, and ``bring all your friends''. He accepted the offer 
  650. and brought his friends. That's how Dartmouth stole Princeton's 
  651. math department.
  652.                                          At Dartmouth, Kemeny 
  653. invented several new branches of mathematics. Then Kemeny's 
  654. department got General Electric to sell Dartmouth a computer at 
  655. 90% discount, in return for which his department had to invent 
  656. programs for it and let General Electric use them. To write the 
  657. programs, Kemeny invented his own little computer language in 
  658. 1963 and showed it to his colleague Thomas Kurtz, who knew less 
  659. about philosophy but more about computers. Kurtz added features 
  660. from ALGOL and FORTRAN and called the combination ``BASIC''.
  661.                                          After inventing BASIC, 
  662. Kemeny became bored and thought of quitting Dartmouth. Then 
  663. Dartmouth asked him to become president of the college. He 
  664. accepted.
  665.                                          Later, when the 
  666. Three-Mile Island nuclear power plant almost exploded, President 
  667. Jimmy Carter told Kemeny to head the investigation, because of 
  668. Kemeny's reputation for profound philosophical and scientific 
  669. impartiality. Kemeny's report was impartial ___ and sharply 
  670. critical of the nuclear industry.
  671.                                          How BASIC compares with 
  672. ALGOL and FORTRAN BASIC is simpler than both ALGOL and FORTRAN in 
  673. two ways:
  674.                                          1. In ALGOL and FORTRAN, 
  675. you must tell the computer which variables are integers and which 
  676. are reals. In ALGOL, you do that by saying INTEGER or REAL. In 
  677. FORTRAN, you do that by choosing an appropriate first letter for 
  678. the variable's name. In BASIC, the computer assumes all variables 
  679. are real, unless you specifically say otherwise.
  680.                                          2. In ALGOL and FORTRAN, 
  681. output is a hassle. In FORTRAN, you have to worry about FORMATs. 
  682. In ALGOL, each computer handles output differently ___ and in 
  683. most cases strangely. BASIC's PRINT statement automatically 
  684. invents a good format.
  685.   Is BASIC closer to ALGOL than to FORTRAN? On the one hand, 
  686. BASIC uses the ALGOL words FOR, STEP, and THEN and the ALGOL 
  687. symbol  (or ^). On the other hand, BASIC, uses the FORTRAN words 
  688. RETURN and DIMENSION (abbreviated DIM); and BASIC's ``FOR I = 1 
  689. TO 9 STEP 2'' puts the step size at the end of the statement, 
  690. like FORTRAN's ``DO 30 I = 1,9,2'' and unlike ALGOL's ``FOR I:=1 
  691. STEP 2 UNTIL 9''.
  692.   Why BASIC overshadows JOSS BASIC is not the simplest computer 
  693. language. JOSS, which was developed a year earlier by the RAND 
  694. Corporation, is simpler to learn. But JOSS doesn't have string 
  695. variables and doesn't name programs (you must give each program a 
  696. number instead, and remember what the number was). Also, programs 
  697. written in JOSS run more slowly and require more of the 
  698. computer's memory than if written in BASIC.
  699.   A few programmers still use JOSS and three of its variants, 
  700. which are called AID, FOCAL, and MUMPS. They all run on computers 
  701. built by DEC. AID is used by high-school kids on PDP-8 computers, 
  702. FOCAL by scientists on PDP-10 computers, and MUMPS by doctors 
  703. designing databases of patient records on PDP-11 computers. 
  704. Though MUMPS does have string variables and other modern 
  705. features, it's gradually being replaced by newer database 
  706. languages such as DBASE.
  707.   Six versions Kemeny and Kurtz finished the original version of 
  708. BASIC in May 1964. It included just these statements: PRINT, GO 
  709. TO, IF...THEN, FOR...NEXT, DATA...READ, GOSUB...RETURN, DIM, LET 
  710. (for commands such as LET X=3), REM (for REMarks and comments), 
  711. DEF (to DEFine your own functions), and END.
  712.   In that version, the only punctuation allowed in the PRINT 
  713. statement was the comma. The second version of BASIC (October 
  714. 1964) added the semicolon.
  715.   The third version (1966) added the words INPUT, RESTORE, and 
  716. MAT. (The word MAT helps you manipulate a ``MATrix'', which means 
  717. an ``array''. Today, most versions of BASIC omit the word MAT, 
  718. because its definition consumes too much RAM.)
  719.   In all those versions, you could use variables. For example, 
  720. you could say LET X=3. A variable was a letter that stood for a 
  721. number. The fourth version (1967) added a new concept: string 
  722. variables (such as A$). That version also added TAB (to improve 
  723. the printing), RANDOMIZE (to improve RND), and ON...GO TO.
  724.   The fifth version (1970) added data files (sequential access 
  725. and random access).
  726.   The sixth version (1971) added PRINT USING and a sophisticated 
  727. way to handle subroutines ___ a way so sophisticated that most 
  728. microcomputers don't have it yet!
  729.   How BASIC became popular During the 1960's and 1970's, Kemeny 
  730. and Kurtz worked on BASIC with a fervor that was almost 
  731. religious. They believed every college graduate should know how 
  732. to program a computer, and be as literate in BASIC as in English. 
  733. They convinced Dartmouth to spend as much on its computer as on 
  734. the college library. They put computer terminals in practically 
  735. every college building (even in the dorms), and let all the kids 
  736. who lived in the town come onto the campus and join the fun. 
  737. Altogether, the campus had about 300 terminals. Over 90% of all 
  738. Dartmouth students used BASIC before they graduated.
  739.   Dartmouth trained high-school teachers how to use BASIC. Soon 
  740. many colleges, high schools, and prep schools throughout New 
  741. England had terminals connected to Dartmouth's computer via 
  742. telephone.
  743.                                          General Electric, which 
  744. built Dartmouth's computer, quit making computers and sold its 
  745. computer factory to Honeywell. So today, Dartmouth's computer is 
  746. called a ``Honeywell''.
  747.                                          Since Dartmouth's 
  748. research on BASIC was partially funded by the National Science 
  749. Foundation, BASIC was in the public domain. Other computer 
  750. manufacturers could use it without having to worry about 
  751. copyrights or patents.
  752.                                          DEC The first company to 
  753. copy Dartmouth's ideas was Digital Equipment Corporation (DEC).
  754.                                          DEC put BASIC and FOCAL 
  755. on DEC's first popular minicomputer, the PDP-8. When DEC saw that 
  756. programmers preferred BASIC, DEC stopped developing FOCAL and 
  757. devoted all its energies to improving BASIC further.
  758.                                          DEC invented fancier 
  759. minicomputers (the PDP-11 and Vax) and maxicomputers (the 
  760. Decsystem-10 and Decsystem-20) and put BASIC on all of them. 
  761. DEC's versions of BASIC were similar to Dartmouth's. Though the 
  762. versions put on the PDP-8 were quite primitive (almost as bad as 
  763. Dartmouth's first edition), the versions put on DEC's fancier 
  764. computers were more sophisticated. Eventually, DEC put decent 
  765. versions of BASIC even on the PDP-8.
  766.                                          DEC's best version of 
  767. BASIC is VAX BASIC, which works only on VAX computers. DEC's 
  768. second-best version of BASIC is BASIC-PLUS-2, which works on the 
  769. VAX, the PDP-11, and the Decsystem-20. DEC's third-best version 
  770. of BASIC is BASIC-PLUS, which works only on the PDP-11. DEC's 
  771. other versions of BASIC aren't as fancy.
  772.                                          Hewlett-Packard Soon 
  773. after DEC started putting BASIC on its computers, Hewlett-Packard 
  774. decided to do likewise: Hewlett-Packard put BASIC on the HP-2000 
  775. computer, and then put a better version of BASIC on the HP-300 
  776. computer.
  777.                                          Unfortunately, 
  778. Hewlett-Packard's BASIC was more difficult to use than DEC's. On 
  779. Hewlett-Packard computers, each time you used a string you had to 
  780. write a ``DIM statement'' that warned the computer how long the 
  781. string would be: the DIM statement had to say how many characters 
  782. the string would contain.
  783.                                          Other major 
  784. manufacturers Most other manufacturers imitate the versions of 
  785. BASIC invented by Dartmouth and DEC. Unfortunately, Data General, 
  786. Wang, and IBM made the mistake of copying Hewlett-Packard 
  787. instead.
  788.                                          That's how BASIC 
  789. developed on maxicomputers and minicomputers.
  790.                                          How Microsoft BASIC 
  791. arose The first popular microcomputer was the Altair 8800, which 
  792. used a version of BASIC invented by a 20-year-old kid named Bill 
  793. Gates. His version imitated DEC's.
  794.                                          The Altair computer was 
  795. manufactured by a company called Mits. When Mits didn't treat 
  796. Bill Gates fairly, he broke away from Mits and formed his own 
  797. company, called Microsoft.
  798.   Bill Gates and his company, Microsoft, invented many versions 
  799. of BASIC. The first was called 4K BASIC, because it consumed only 
  800. 4K of memory chips (RAM or ROM). Then came 8K BASIC, which 
  801. included a larger vocabulary. Then came Extended BASIC, which 
  802. included an even larger vocabulary and consumed 14K. All those 
  803. versions were intended for primitive microcomputers that used 
  804. tapes instead of disks. Finally came Disk BASIC, which came on a 
  805. disk and included all the commands for handling disks. His Disk 
  806. BASIC version 4 was further improved, to form Disk BASIC version 
  807. 5, which is the version of BASIC still used on CP/M computers and 
  808. on the Radio Shack model 4. It's also called MBASIC and BASIC-80.
  809.   All those versions of BASIC were written for computers that 
  810. contained an 8080 or Z-80 CPU. Simultaneously, he wrote 6502 
  811. BASIC, for Apple 2 and Commodore computers. The Apple 2 version 
  812. of 6502 BASIC is called Applesoft BASIC; Commodore's version of 
  813. 6502 BASIC is called Commodore BASIC.
  814.   Unfortunately, 6502 BASIC is rather primitive: it resembles his 
  815. 8K BASIC. So if you're trying to learn advanced BASIC 
  816. programming, you should not get an Apple 2e or 2c or Commodore 
  817. 64!
  818.   After writing 6502 BASIC, Bill wrote an improved version of it, 
  819. called 6809 BASIC, which is available only for Radio Shack's 
  820. Color Computer. Radio Shack calls it Extended Color BASIC.
  821.   Texas Instruments (TI) asked Bill to write a version of BASIC 
  822. for TI computers. Bill said ``yes''. Then TI told Bill what kind 
  823. of BASIC it wanted. Bill's company ___ Microsoft ___ found 90 
  824. ways in which TI's desires would contradict Microsoft's 
  825. traditions. Microsoft convinced TI to change its mind and remove 
  826. 80 of those 90 contradictions, but TI stood firm on the other 10. 
  827. So TI BASIC (which is on the TI-990 and TI-99/4A computers) 
  828. contradicts all other versions of Microsoft BASIC in 10 ways. For 
  829. example, in TI BASIC, the INPUT statement uses a colon instead of 
  830. a semicolon, and a multi-statement line uses a double colon (::) 
  831. instead of a single colon. Because of those differences, TI's 
  832. computers became unpopular, and TI stopped making them. Moral: if 
  833. you contradict Bill, you'll die!
  834.   Bill later invented an amazingly wonderful version of BASIC, 
  835. better than all the other versions that had been invented. He 
  836. called it GW BASIC (which stands for ``Gee-Whiz BASIC''). It runs 
  837. only on the IBM PC and clones.
  838.   When you buy PC-DOS from IBM, you typically get GW BASIC at no 
  839. extra charge. (IBM calls it BASICA.) When you buy MS-DOS for an 
  840. IBM clone, the typical dealer includes GW BASIC at no extra 
  841. charge, but ask!
  842.   Beyond GW BASIC GW BASIC was the last version of BASIC that 
  843. Bill developed personally. All further improvements and 
  844. variations were done by his assistants at Microsoft.
  845.   Microsoft's newest variations are Microsoft BASIC for the Mac, 
  846. Amiga Microsoft BASIC (for the Commodore's Amiga computer), Quick 
  847. BASIC (for the IBM PC and clones), QBASIC (which you get instead 
  848. of GWBASIC when you buy MS-DOS version 5 or 6), and Visual BASIC 
  849. (which lets you easily create Windows-style programs that let the 
  850. human use a mouse and pull-down menus). Those BASICs are slightly 
  851. harder to learn how to use than GW BASIC; but once you understand 
  852. them, you'll prefer them because they run faster and include a 
  853. better editor, more words from ALGOL and PASCAL, and fancier 
  854. output.
  855.                                          While developing those 
  856. versions of BASIC, Microsoft added three new commands that are 
  857. particularly exciting: SAY, END IF, and SUB.
  858.                                          The SAY command makes 
  859. the computer talk, by using a voice synthesizer. for example, to 
  860. make the computer's voice say ``I love you'', type this command:
  861. SAY TRANSLATE$("I LOVE YOU")
  862. That makes the computer translate ``I love you'' into phonetics 
  863. and then say the phonetics. That command works on the Amiga, and 
  864. I hope Microsoft will put it on other computers also.
  865.                                          The END IF and SUB 
  866. commands give BASIC some of PASCAL's power. By using the END IF 
  867. command, you can make the IF statement include many lines, like 
  868. this:
  869. IF AGE<18 THEN
  870.         PRINT "YOU ARE STILL A MINOR."
  871.         PRINT "AH, THE JOYS OF YOUTH!"
  872.         PRINT "I WISH I COULD BE AS YOUNG AS YOU!"
  873. END IF
  874. By using the SUB command, you can give a subroutine a name, like 
  875. this:
  876. PRINT "WE ALL KNOW..."
  877. CALL INSULT
  878. PRINT "...AND YET WE LOVE YOU"
  879.  
  880. SUB INSULT STATIC
  881. PRINT "YOU ARE STUPID"
  882. PRINT "YOU ARE UGLY"
  883. END SUB
  884.                                          Borland Microsoft's main 
  885. competitor for languages is Borland, which made Turbo PASCAL, 
  886. Turbo C, and Turbo BASIC.
  887.                                          Turbo BASIC version 1.1 
  888. runs faster than Quick BASIC, is easier to understand, and 
  889. includes almost as many commands. But Borland has stopped 
  890. marketing Turbo BASIC, so that Borland can devote its energies to 
  891. other Borland products that are more profitable (such as Turbo 
  892. PASCAL, Turbo C, Quattro, and Paradox).
  893.                                          Divergences GW BASIC, 
  894. Microsoft BASIC for the Macintosh, Amiga Microsoft BASIC, Quick 
  895. BASIC, and Turbo BASIC are all wonderful.
  896.                                          Over the years, several 
  897. microcomputer manufacturers tried to invent their own versions of 
  898. BASIC, to avoid paying royalties to Bill Gates. They were sorry!
  899.                                          For example, Radio Shack 
  900. tried hiring somebody else to write Radio Shack's BASIC. That 
  901. person quit in the middle of the job; Radio Shack's original 
  902. BASIC was never completed. Nicknamed ``Level 1 BASIC'', it was a 
  903. half-done mess. Radio Shack, like an obedient puppy dog, then 
  904. went to Bill, who finally wrote a decent version of BASIC for 
  905. Radio Shack; Bill's version was called ``Level 2''. Today, Radio 
  906. Shack uses further improvements on Bill's Level 2 BASIC.
  907.                                          Apple's original attempt 
  908. at BASIC was called ``Apple Integer BASIC''. It was written by 
  909. Steve Wozniak and was terrible: it couldn't handle decimals, and 
  910. it made the mistake of imitating Hewlett-Packard instead of DEC 
  911. (because Steve had worked at Hewlett-Packard). Eventually, Steve 
  912. wised up and hired Bill, who wrote Apple's better BASIC, called 
  913. Applesoft (which means ``Apple BASIC by Microsoft''). Applesoft 
  914. was intended for tapes, not disks. Later, when Steve Wozniak 
  915. wanted to add disks to the Apple computer, he made the mistake of 
  916. not rehiring Bill ___ which is why Apple's disk system is worse 
  917. than Radio Shack's.
  918.   At Atari, an executive who didn't want to hire Bill made the 
  919. mistake of hiring the inventor of Apple's disastrous DOS. That 
  920. guy's BASIC, which is called Atari BASIC, resembles 
  921. Hewlett-Packard's BASIC. Like Apple's DOS, it looks pleasant at 
  922. first glance but turns into a nightmare when you try to do any 
  923. advanced programming. As a result, Atari's computers didn't 
  924. become as popular as Atari hoped, and the executive who ``didn't 
  925. want to hire Bill'' was fired. Atari finally hired Bill's 
  926. company, which wrote Atari Microsoft BASIC version 2.
  927.   Two other microcomputer manufacturers ___ North Star Computers 
  928. and APF ___ tried developing their own versions of BASIC, to 
  929. avoid paying royalties to Bill. Since their versions of BASIC 
  930. were lousy, they went out of business.
  931.   While DEC, Hewlett-Packard, Microsoft, and other companies were 
  932. developing their own versions of BASIC, professors back at 
  933. Dartmouth College were still tinkering with Dartmouth BASIC 
  934. version 6. In 1976, Professor Steve Garland added more commands 
  935. from ALGOL, PL/I, and PASCAL to Dartmouth BASIC. He called his 
  936. version ``Structured BASIC'' or SBASIC.
  937.   One of BASIC's inventors, Professor Tom Kurtz, became chairman 
  938. of an ANSI committee to standardize BASIC. His committee 
  939. published two reports.
  940.   The 1977 report defined ANSI Standard Minimal BASIC, a minimal 
  941. standard that all  advertised versions of ``BASIC'' should live 
  942. up to. That report was quite reasonable, and everybody agreed to 
  943. abide by it. (Microsoft's old versions of BASIC were written 
  944. before that report came out. Microsoft Disk BASIC version 5 was 
  945. Microsoft's first version to obey that standard.)
  946.   In 1985, ANSI created a more ambitious report, to standardize 
  947. the most advanced aspects of BASIC. The report said that the 
  948. advanced aspects of BASIC should closely follow SBASIC and the 
  949. other versions developed at Dartmouth. But Bill Gates, who 
  950. invented Microsoft BASIC and was also one of the members of the 
  951. committee, disliked some aspects of Dartmouth's BASIC and quit 
  952. the committee. (He was particularly annoyed by the committee's 
  953. desire to include Dartmouth's MAT commands, which consume lots of 
  954. RAM and which hardly anybody uses.) He refused to follow the 
  955. committee's recommendations.
  956.                              That left two standards for advanced 
  957. BASIC: the ``official'' standard, defined by the ANSI committee; 
  958. and the ``de facto'' standard, which is Bill Gates' GW BASIC, the 
  959. version of BASIC that most people use.
  960.                              The two standards are quite 
  961. different from each other. For example, in GW BASIC you say:
  962. 10 INPUT "WHAT IS YOUR NAME"; A$
  963. In ANSI BASIC, you say this instead:
  964. 10 INPUT PROMPT "WHAT IS YOUR NAME? ": A$
  965. Notice that in ANSI BASIC, you must insert the word PROMPT after 
  966. INPUT, insert a questions mark and blank space before the second 
  967. quotation mark, and type a colon instead of a semicolon.
  968.                              Tom Kurtz (who chaired the ANSI 
  969. committee) and John Kemeny (who invented BASIC with Tom Kurtz) 
  970. put ANSI BASIC onto Dartmouth's computer. So ANSI BASIC became 
  971. Dartmouth's seventh official version of BASIC.
  972.                              Then Kurtz and Kemeny left Dartmouth 
  973. and formed their own company, which invented True BASIC. It's a 
  974. version of ANSI BASIC that runs on the IBM PC and the Apple 
  975. Macintosh.
  976.                              In some ways, True BASIC is slightly 
  977. better than Microsoft's GW BASIC and Quick BASIC. In other ways, 
  978. True BASIC is slightly worse. Since Microsoft's BASIC versions 
  979. have become the de facto standard, and since True BASIC isn't 
  980. significantly better, hardly anybody is switching from Microsoft 
  981. BASIC to True BASIC.
  982.                              Comparison chart This chart compares 
  983. the most popular versions of BASIC for microcomputers today:
  984.                                                        ┌───────┬─
  985. ──────┬───────┐
  986.                                                        │ Video │ 
  987. Audio │ Logic │
  988.                                                        ├───────┼─
  989. ──────┼───────┤
  990.                                                        │       │       
  991. │       │
  992.                                                        │       │       
  993. │       │
  994.                                                        │       │       
  995. │       │
  996. ┌──────────────────────────────────────────────────────┼───────┼─
  997. ──────┼───────┤
  998. │Commodore Amiga with Microsoft BASIC                  │ √ √ √ │ 
  999. √   √ │ √ √ √ │
  1000. │IBM PC color with Visual BASIC 2 or 3 or QBASIC       │ √ √ √ │ 
  1001. √ √   │ √ √ √ │
  1002. ├──────────────────────────────────────────────────────┼───────┼─
  1003. ──────┼───────┤
  1004. │Apple Macintosh with Quick BASIC                      │ √ √ √ │ 
  1005. √     │ √ √ √ │
  1006. ├──────────────────────────────────────────────────────┼───────┼─
  1007. ──────┼───────┤
  1008. │IBM PC color GW BASIC, Commodore 128, or TRS-80 Color │ √ √ √ │ 
  1009. √ √   │ √     │
  1010. ├──────────────────────────────────────────────────────┼───────┼─
  1011. ──────┼───────┤
  1012. │Atari ST                                              │ √ √ √ │ 
  1013. √     │ √     │
  1014. ├──────────────────────────────────────────────────────┼───────┼─
  1015. ──────┼───────┤
  1016. │Atari XE (or XL) with Microsoft BASIC                 │ √ √   │ 
  1017. √     │ √     │
  1018. │IBM PC monochrome with GW BASIC                       │ √     │ 
  1019. √ √   │ √     │
  1020. ├──────────────────────────────────────────────────────┼───────┼─
  1021. ──────┼───────┤
  1022. │TRS-80 Model 3, 4, 4P, or 4D                          │ √     │       
  1023. │ √     │
  1024. ├──────────────────────────────────────────────────────┼───────┼─
  1025. ──────┼───────┤
  1026. │Apple 2, 2+, 2e, 2c, 2c+, or 2GS                      │   √   │       
  1027. │       │
  1028. ├──────────────────────────────────────────────────────┼───────┼─
  1029. ──────┼───────┤
  1030. │Commodore 64 or Vic-20                                │       │       
  1031. │       │
  1032. └──────────────────────────────────────────────────────┴───────┴─
  1033. ──────┴───────┘
  1034.                              It shows which versions of BASIC 
  1035. understand these 9 words: USING, LINE, CIRCLE, SOUND, PLAY, SAY, 
  1036. ELSE, END IF, and SUB.
  1037.                              The versions of BASIC at the top of 
  1038. the chart (Amiga BASIC, Visual BASIC, and QBASIC) are the best: 
  1039. they understand 8 of the 9 words. The versions of BASIC at the 
  1040. bottom of the chart (Commodore 64 BASIC & Vic-20 BASIC) are the 
  1041. worst: they understand none of the words.
  1042.                              Here's what those 9 words 
  1043. accomplish. The word USING (which you put immediately after the 
  1044. word PRINT) lets you control how many digits the computer will 
  1045. print after the decimal point. LINE makes the computer draw a 
  1046. diagonal line across the screen. CIRCLE makes the computer draw a 
  1047. circle as big as you wish. SOUND and PLAY make the computer 
  1048. create music. SAY makes the computer talk. ELSE and END IF let 
  1049. you create fancy IF statements. SUB lets you name subroutines.
  1050.                              Although the Commodore 128 and Radio 
  1051. Shack TRS-80 Color Computer are cheap, the chart shows their 
  1052. versions of BASIC are better than the Apple 2c's. If schools 
  1053. would have bought Commodore 128 and Radio Shack TRS-80 Color 
  1054. Computers instead of Apple 2c's, students would be better 
  1055. programmers!
  1056.                 PL/I
  1057.   During the early 1960's, IBM sold two kinds of computers. One 
  1058. kind was for use by scientists; the other kind was for use by 
  1059. business bookkeepers. For the scientific kind of computer, the 
  1060. most popular language was FORTRAN. For the business kind of 
  1061. computer, the most popular language was COBOL.
  1062.   In 1962, IBM secretly began working on a project to create a 
  1063. single, large computer that could be used by everybody: 
  1064. scientists and businesses. IBM called it the IBM 360, because it 
  1065. could handle the full circle of applications.
  1066.   What language should the IBM 360 be programmed in? IBM decided 
  1067. to invent a single language that could be used for both science 
  1068. and business.
  1069.   IBM's first attempt at such a language was ``FORTRAN V''. It 
  1070. ran all the FORTRAN IV programs but also included commands for 
  1071. handling strings and fields in data files. But IBM never 
  1072. announced FORTRAN V to the public; instead, in 1963 IBM began 
  1073. working on a dramatically more powerful language called ``FORTRAN 
  1074. VI'', which would resemble FORTRAN but be much more powerful and 
  1075. modern (and hence incompatible). It would also include all the 
  1076. important features of COBOL and ALGOL.
  1077.   As work on FORTRAN VI progressed, IBM realized it would be so 
  1078. different from traditional FORTRAN that it should have a 
  1079. different name. In 1964, IBM changed the name to ``NPL'' (New 
  1080. Programming Language), since the language was intended to go with 
  1081. the IBM 360 and the rest of IBM's New Product Line.
  1082.   When IBM discovered that the letters ``NPL'' already stood for 
  1083. the National Physics Laboratory in England, IBM changed the 
  1084. language's name to Programming Language One (PL/I), to brag it 
  1085. was the first good programming language and all its predecessors 
  1086. were worth zero by comparison.
  1087.   Troublesome timing The committee that invented PL/I had a hard 
  1088. time. The committee consisted of just 6 official members (3 from 
  1089. IBM and 3 from a FORTRAN user group). A few friends of the 
  1090. committee attended also. The committee could meet only on 
  1091. weekends, and only in hotel rooms in New York State and 
  1092. California. The first meeting was in October 1963 (at the 
  1093. Motel-on-the-Mountain on the New York Thruway), and IBM insisted 
  1094. that the entire language design be finished by December. It was a 
  1095. rush job!
  1096.   The committee didn't meet the deadline. It finished two months 
  1097. late, in February.
  1098.   After the design was finished, the language still had to be put 
  1099. onto the computer. Since that took 2½ more years of programming 
  1100. and polishing, the language wasn't available for sale to IBM's 
  1101. customers until August 1966.
  1102.   That was too late. It was after IBM had already begun shipping 
  1103. the IBM 360. The 360's customers continued using FORTRAN and 
  1104. COBOL, since PL/I wasn't available initially. After those 
  1105. customers bought, installed, and learned how to use FORTRAN and 
  1106. COBOL on the 360, they weren't willing to switch to PL/I. 
  1107. Switching was too much trouble.
  1108.   Other troubles PL/I was expensive to run. It required twice as 
  1109. much RAM as COBOL, four times as much RAM as FORTRAN. It ran 
  1110. slowly: it took 1½ times as long to compile as COBOL, twice as 
  1111. long as FORTRAN.
  1112.   Another obstacle to PL/I's acceptance was lethargy: most 
  1113. programmers already knew FORTRAN and COBOL, were satisfied with 
  1114. those languages, and weren't willing to spend the time to learn 
  1115. something new.
  1116.                                          Some programmers praise 
  1117. PL/I for being amazingly powerful. Others call it just a scheme 
  1118. by IBM to get people to buy more RAM. Others call it a 
  1119. disorganized mess, an ``ugly kitchen sink of a language'', thrown 
  1120. together by a committee that was in too much of a rush.
  1121.                                          Since PL/I is such a 
  1122. large language, hardly anybody understands it all. As a typical 
  1123. harried PL/I programmer, you study just the part of the language 
  1124. you intend to use. But if you make a mistake, the computer might 
  1125. not gripe: instead, it might think you're trying to give a 
  1126. different PL/I command from a different part of the language that 
  1127. you never studied. So instead of griping, the computer will 
  1128. perform an instruction that wasn't what you meant.
  1129.                                          Universities 
  1130. Universities debated which language to teach freshman. For a 
  1131. while, the choice was between FORTRAN (the ``standard''), ALGOL 
  1132. (the ``pure and simple''), and PL/I (the ``powerful'').
  1133.                                          In 1972, Cornell 
  1134. University developed a stripped-down version of PL/I for 
  1135. students. That version, called PL/C, is a compromise between 
  1136. PL/I's power and ALGOL's pure simplicity.
  1137.                                          In 1975, The University 
  1138. of Toronto developed an even more stripped-down version of PL/I, 
  1139. and called it SP/k. Although it allows fewer statements than 
  1140. PL/C, it runs faster and prints messages that are even more 
  1141. helpful. SP/k comes in several sizes: the tiniest is SP/1; the 
  1142. largest is SP/8.
  1143.                                          Stripped-down versions 
  1144. of PL/I remained popular in universities until about 1980, when 
  1145. they began to be replaced by PASCAL.
  1146.                                          Microcomputers Digital 
  1147. Research invented a tiny version of PL/I for microcomputers, and 
  1148. called it PL/M. Unfortunately, PL/M can't handle decimals. PL/M 
  1149. was popular during the late 1970's and early 1980's, but most 
  1150. PL/M programmers eventually switched to C.
  1151.                                          Maxicomputers PL/I is 
  1152. still used on large IBM computers, because it's the only language 
  1153. that includes enough commands to let programmers unleash IBM's 
  1154. full power.
  1155.                                          Statements PL/I uses 
  1156. many statements for input and output. The statement's meaning 
  1157. depends mainly on the statement's first word:
  1158. First word                                     What the computer 
  1159. will do
  1160. GET                                            input from a 
  1161. terminal or simple file
  1162. PUT                                            print on a 
  1163. terminal or simple file
  1164.  
  1165. OPEN                                           start using a file
  1166. CLOSE                                          stop using a file
  1167.  
  1168. READ                                           input from a file 
  1169. whose picture is unedited
  1170. WRITE                                          print on a file 
  1171. whose picture is unedited
  1172.  
  1173. DELETE                                         delete an item 
  1174. from a file
  1175. REWRITE                                        replace an item in 
  1176. a file
  1177.  
  1178. LOCATE                                         print a "based" 
  1179. variable onto a file
  1180. UNLOCK                                         let other programs 
  1181. use the file
  1182.  
  1183. FORMAT                                         use a certain form 
  1184. for spacing the input and output
  1185. DISPLAY                                        chat with operator 
  1186. who sits at computer's main terminal
  1187.                                          These statements 
  1188. interrupt:
  1189. First word                                     What the computer 
  1190. will do
  1191. STOP                                           stop the program
  1192. EXIT                                           stop a task (in a 
  1193. program that involves several tasks)
  1194. HALT                                           interrupt the 
  1195. program; free the terminal to do other tasks
  1196.  
  1197. DELAY                                          pause for a 
  1198. certain number of milliseconds
  1199. WAIT                                           pause until other 
  1200. simultaneous routines finish their tasks
  1201.  
  1202.   These statements handle conditions:
  1203. First wordWhat the computer will do
  1204. IF      if a certain condition occurs now, do certain statements
  1205. ON      if a certain condition occurs later, do certain 
  1206. statements
  1207.  
  1208. SIGNAL  pretend a condition such as OVERFLOW occurs
  1209. REVERT  cancel the ON statements
  1210.   These statements handle variables:
  1211. First wordWhat the computer will do
  1212. DECLARE make some variables be integers, other be reals, etc.
  1213. DEFAULT assume all variables are integers, or a similar 
  1214. assumption
  1215.  
  1216. ALLOCATEcreate a temporary variable
  1217. FREE    destroy a temporary variable and use its RAM otherwise
  1218.   These statements handle general logic:
  1219. First wordWhat the computer will do
  1220. GO      go to a different line
  1221. CALL    go to a subroutine
  1222.  
  1223. RETURN  return from a subroutine to the main routine
  1224. ENTRY   skip the subroutine's previous lines; begin here instead
  1225.  
  1226. PROCEDUREbegin a program or subprogram
  1227. DO      begin a loop or compound statement
  1228.  
  1229. BEGIN   begin a block of statements
  1230. END     end program, subprog., loop, compound statem't, or block
  1231.   Half of those statements are borrowed from FORTRAN, ALGOL, and 
  1232. COBOL.
  1233. from FORTRAN:FORMAT, STOP, CALL, RETURN, DO
  1234. from ALGOL:IF, GO, PROCEDURE, BEGIN, END
  1235. from COBOL:OPEN, CLOSE, READ, WRITE, DISPLAY, EXIT
  1236.   Like ALGOL, PL/I requires a semicolon at the end of each 
  1237. statement. Besides the statements listed above, you can also give 
  1238. an assignment statement (such as ``N=5;''), a null statement 
  1239. (which consists of just a semicolon), and a preprocessor 
  1240. statement (which tells the computer how to create its own 
  1241. program).
  1242.  
  1243.                PASCAL
  1244.   In 1968, a European committee tried to invent an improved 
  1245. version of ALGOL. The majority of the committee agreed on a 
  1246. version called ``ALGOL 68''. It was strange: it even required you 
  1247. to spell some commands backwards.
  1248.   A few members of the committee were dissidents who disagreed 
  1249. with the majority and thought ALGOL 68 was nuts. One of the 
  1250. dissidents, Niklaus Wirth, quit the committee and created his own 
  1251. version of ALGOL. He called his version PASCAL. Today, most 
  1252. computerists feel he was right and the majority of the committee 
  1253. was wrong, PASCAL is better than ALGOL 68.
  1254.   He wrote PASCAL in Switzerland, for a CDC maxicomputer that 
  1255. used punched cards. His version of PASCAL couldn't handle video 
  1256. screens, couldn't handle random-access data files, and couldn't 
  1257. handle strings well. Those three limitations were corrected in 
  1258. later versions of PASCAL ___ especially the version invented at 
  1259. the University of California at San Diego (UCSD), which even 
  1260. includes LOGO-style commands that move a turtle.
  1261.                                          Apple's PASCAL Apple 
  1262. Computer Company got permission to sell an Apple version of UCSD 
  1263. PASCAL. Apple ran full-page advertisements, bragging that the 
  1264. Apple 2 was the only popular microcomputer that could handle 
  1265. PASCAL.
  1266.                                          For $495, Apple Computer 
  1267. Company sold the ``Apple Language System'', which included 4 
  1268. disks containing PASCAL, 2 disks containing souped-up BASIC, and 
  1269. a card containing 16K of extra RAM. Many people spent the $495 
  1270. for PASCAL but were disappointed. They expected that by spending 
  1271. $495, they'd be able to write programs more easily, but they 
  1272. discovered that PASCAL is harder to learn than BASIC.
  1273.                                          PASCAL is helpful only 
  1274. if the program you're writing is very, very long. PASCAL helps 
  1275. you organize and dissect long programs more easily than BASIC. 
  1276. But the average Apple owner never writes long programs and never 
  1277. needs PASCAL.
  1278.                                          Many customers felt 
  1279. ``ripped off'', since they had spent $495 and received no benefit 
  1280. in return. But maybe that's what ``marketing'' is all about.
  1281.                                          PASCAL's popularity Many 
  1282. programmers who've been writing large FORTRAN programs for large 
  1283. computers are switching to PASCAL, because PASCAL helps organize 
  1284. large programs better, and because FORTRAN is archaic. Many 
  1285. programmers who've been using PL/I are switching to PASCAL, 
  1286. because PASCAL consumes less RAM than PL/I and fits in smaller 
  1287. computers.
  1288.                                          Most colleges require 
  1289. freshman computer-science majors to take PASCAL.
  1290.                                          Most high-school seniors 
  1291. who want to attend college take tests given by the College 
  1292. Entrance Examination Board. The most famous such test is the 
  1293. Scholastic Aptitude Test (SAT), but the board offers many others. 
  1294. One of the board's newest tests is the Advanced Placement Test in 
  1295. Computer Science; a high-school senior who scores high on that 
  1296. test can skip the first year of college computer-science courses 
  1297. and go immediately into college-sophomore courses. Since that 
  1298. test requires a knowledge of PASCAL, many high-school seniors are 
  1299. studying PASCAL.
  1300.                                          Best versions The most 
  1301. powerful PASCAL for microcomputers is Turbo PASCAL, published by 
  1302. Borland. It's available for the IBM PC, Mac, and CP/M computers.
  1303.                                          If you have a Mac, get 
  1304. either the Mac version of Turbo PASCAL or Think PASCAL. If you 
  1305. have an Apple 2e or 2c, get Instant PASCAL (which is much easier 
  1306. to use than the UCSD PASCAL that was sold under the name ``Apple 
  1307. PASCAL'').
  1308.                                          If you have a Radio 
  1309. Shack TRS-80 model 3 or 4, get PASCAL 80, which costs $79.95 from 
  1310. New Classics Software (239 Fox Hill Rd., Denville, NJ 07834, 
  1311. phone 201-538-3131 days, 201-625-8838 evenings, ask for George 
  1312. Blank). If you're running a school, you'll love this deal: for 
  1313. just $279, you get the right to make unlimited copies of PASCAL 
  1314. 80 and use them throughout your school building.
  1315.                      MODULA
  1316.   After Niklaus Wirth invented PASCAL, he began designing a more 
  1317. ambitious language, called MODULA.
  1318.   He designed the first version of MODULA in 1975. In 1979 he 
  1319. designed an improvement called MODULA-2. When today's programmers 
  1320. discuss ``MODULA'', they mean MODULA-2.
  1321.   MODULA-2 is very similar to PASCAL. Like PASCAL, MODULA-2 
  1322. requires each program's main routing to begin with the word 
  1323. BEGIN; but MODULA-2 does not require you to say BEGIN after DO 
  1324. WHILE or IF THEN:
  1325. PASCAL                  MODULA-2
  1326. IF AGE<18 THEN          IF AGE<18 THEN
  1327.    BEGIN                   WRITESTRING("YOU ARE STILL A MINOR");
  1328.    WRITELN('YOU ARE STILL A MINOR');   WRITESTRING("AH, THE JOYS 
  1329. OF YOUTH");
  1330.    WRITELN('AH, THE JOYS OF YOUTH');ELSE
  1331.    END                     WRITESTRING("GLAD YOU ARE AN ADULT");
  1332. ELSE                       WRITESTRING("WE CAN HAVE ADULT FUN")
  1333.    BEGIN                END;
  1334.    WRITELN('GLAD YOU ARE AN ADULT');
  1335.    WRITELN('WE CAN HAVE ADULT FUN');
  1336.    END;
  1337.   That example shows four ways that MODULA-2 differs from PASCAL: 
  1338. MODULA-2 says WRITESTRING instead of WRITELN, uses regular 
  1339. quotation marks (") instead of apostrophes, lets you omit the 
  1340. word BEGIN after IF ELSE (and WHILE DO), and lets you omit the 
  1341. word END before ELSE.
  1342.   Advanced programmers like MODULA-2 better than PASCAL because 
  1343. MODULA-2 includes extra commands for handling subroutines.
  1344.  
  1345.                         C
  1346.   Many programmers are starting to use C.
  1347.   How C arose In 1963 at England's Cambridge University and the 
  1348. University of London, researchers developed a ``practical'' 
  1349. version of ALGOL and called it the Combined Programming Language 
  1350. (CPL). In 1967 at Cambridge University, Martin Richards invented 
  1351. a simpler, stripped-down version of CPL and called it Basic CPL 
  1352. (BCPL). In 1970 at Bell Labs, Ken Thompson developed a version 
  1353. that was even more stripped-down and simpler; since it included 
  1354. just the most critical part of BCPL, he called it B.
  1355.   Ken had stripped down the language too much. It no longer 
  1356. contained enough commands to do practical programming. In 1972, 
  1357. his colleague Dennis Ritchie added a few commands to B, to form a 
  1358. more extensive language. Since that language came after B, it was 
  1359. called C.
  1360.   So C is a souped-up version of B, which is a stripped-down 
  1361. version of BCPL, which is a stripped-down version of CPL, which 
  1362. is a ``practical'' version of ALGOL.
  1363.   Bell Labs invented an operating system called Unix. The 
  1364. original version of Unix was created by using B. The newest 
  1365. versions of Unix were created by using C instead, which is more 
  1366. powerful.
  1367.   C's peculiarities Like B, C is a tiny language. It doesn't even 
  1368. include any words for input or output. When you buy C, you also 
  1369. get a library of routines that can be added to C. The library 
  1370. includes words for input and output (such as printf and scanf), 
  1371. math functions (such as sqrt), and other goodies. When you write 
  1372. a program in C, you can choose whichever parts of the library you 
  1373. need: the other parts of the library don't bother to stay in RAM. 
  1374. So if your program uses just a few of the library's functions, 
  1375. running it will consume very little RAM. It will consume less RAM 
  1376. than if the program were written in BASIC or PASCAL.
  1377.   In BASIC, if you reserve 20 RAM locations for X (by saying DIM 
  1378. X(20)) and then say X(21)=3.7, the computer will gripe, because 
  1379. you haven't reserved a RAM location of X(21). If you use C 
  1380. instead, the computer will not gripe about that kind of error; 
  1381. instead, the computer will store the number 3.7 in the RAM 
  1382. location immediately after X(20), even if that location's already 
  1383. being used by another variable, such as Y. As a result, Y will 
  1384. get messed up. Moral: C programs run quickly and dangerously, 
  1385. because in C the computer never bothers to check your program's 
  1386. reasonableness.
  1387.                                                      In your 
  1388. program, which variables are integers, and which are real? BASIC 
  1389. assumes they're all real. FORTRAN and PL/I assume all variables 
  1390. beginning with I, J, K, L, M, and N are integers and the rest are 
  1391. real. ALGOL and PASCAL make no assumptions at all; they require 
  1392. you to write a declaration saying ``integer'' or ``real'' for 
  1393. each variable. C, by contrast, assumes all variables are 
  1394. integers, unless you specifically say otherwise.
  1395.  
  1396.                                                               ADA
  1397.                                                      In 1975, the 
  1398. U.S. Department of Defense decided it wanted a new kind of 
  1399. computer language, so the Department wrote a list of requirements 
  1400. the language would have to meet.
  1401.                                                      The original 
  1402. list of requirements was called the Strawman Requirements (1975). 
  1403. Then came improved versions, called Woodenman (1975), Tinman 
  1404. (1976), Ironman (1978), and finally Steelman (1979).
  1405.                                                      While the 
  1406. Department was moving from Strawman to Steelman, it also checked 
  1407. whether any existing computer language could meet such 
  1408. requirements. The Department concluded that no existing computer 
  1409. language came even close to meeting the requirements, and so a 
  1410. new language would indeed have to be invented. The Department 
  1411. also concluded that the new language would have to resemble 
  1412. PASCAL, ALGOL 68, or PL/I, but be better.
  1413.                                                      Contest In 
  1414. 1977, the Department held a contest, to see which software 
  1415. company could invent a language meeting such specifications 
  1416. (which were in the process of changing from Tinman to Ironman). 
  1417. 16 companies entered the contest.
  1418.                                                      The 
  1419. Department selected 4 semifinalists and paid them to continue 
  1420. their research for six more months. The semifinalists were 
  1421. CII-Honeywell-Bull (which is French and owned partly by 
  1422. Honeywell), Intermetrics (in Cambridge, Massachusetts), SRI 
  1423. International, and Softech.
  1424.                                                      In 1978, the 
  1425. semifinalists submitted improved designs, which were all 
  1426. souped-up versions of PASCAL (instead of ALGOL 68 or PL/I). To 
  1427. make the contest fair and prevent bribery, the judges weren't 
  1428. told which design belonged to which company. The 4 designs were 
  1429. called ``Green'', ``Red'', ``Yellow'', and ``Blue''.
  1430.   Yellow and Blue lost. The winning designs were Green (designed 
  1431. by CII-Honeywell-Bull) and Red (designed by Intermetrics).
  1432.   The Department paid the two winning companies to continue their 
  1433. research for one more year. In 1979, the winning companies 
  1434. submitted their improved versions. The winner was the Green 
  1435. language, designed by CII-Honeywell-Bull.
  1436.   The Department decided that the Green language would be called 
  1437. ADA to honor Ada Lovelace, the woman who was the world's first 
  1438. programmer.
  1439.   So ADA is a PASCAL-like language developed by a French company 
  1440. under contract to the U.S. Department of Defense.
  1441.   Popularity Will ADA become popular? Wait and see.
  1442.   Many researchers are trying to make computers understand ADA. 
  1443. So far, the results are incomplete: you can buy disks containing 
  1444. parts of ADA, but the full version isn't on disk yet.
  1445.   When full versions of ADA become available and programmers try 
  1446. using them, we'll know whether the language is a pleasure or a 
  1447. pain.
  1448.  
  1449.                 DBASE
  1450.   DBASE was invented by Wayne Ratliff because he wanted to bet on 
  1451. which football teams would win the 1978 season. To bet wisely, he 
  1452. had to know how each team had scored in previous games, so every 
  1453. Monday he clipped pages of football scores from newspapers. Soon 
  1454. his whole room was covered with newspaper clippings. To reduce 
  1455. the clutter, he decided to write a data-management program to 
  1456. keep track of all the statistics.
  1457.   He worked at the Jet Propulsion Laboratory (JPL). His coworkers 
  1458. had invented a data-management system called the JPL Display and 
  1459. Information System (JPLDIS), which imitated IBM's RETRIEVE.
  1460.   Unfortunately, RETRIEVE and JPLDIS both required maxicomputers. 
  1461. Working at home, he invented VULCAN, a stripped-down version of 
  1462. JPLDIS that was small enough to run on the CP/M microcomputer in 
  1463. his house. It was even good enough to let him compile football 
  1464. statistics ___ though by then he'd lost interest in football and 
  1465. was more interested in the theory of data management and business 
  1466. applications.
  1467.   In 1979, he advertised his VULCAN data-management system in 
  1468. Byte Magazine. The mailman delivered so many orders to his house 
  1469. that he didn't have time to fill them all ___ especially since he 
  1470. still had a full-time job at JPL. He stopped advertising, to give 
  1471. himself a chance to catch up on filling the orders.
  1472.   In 1980, the owners of Discount Software phoned him, visited 
  1473. his home, examined VULCAN, and offered to market it for him. He 
  1474. agreed.
  1475.   Since ``Discount Software'' was the wrong name to market VULCAN 
  1476. under, Discount Software's owners ___ Hal Lashlee and George Tate 
  1477. ___ thought of marketing VULCAN under the name ``Lashlee-Tate 
  1478. Software''. But since the ``Lashlee'' part sounded too wimpy, 
  1479. they changed the name to Ashton-Tate Software.
  1480.   Instead of selling the original version of VULCAN, Ashton-Tate 
  1481. Software decided to sell Wayne's further improvement, called 
  1482. DBASE 2. It ran faster, looked prettier on the screen, and was 
  1483. easier to use.
  1484.   At Ashton-Tate, George Tate did most of the managing. Hal 
  1485. Lashlee was a silent partner who just contributed capital.
  1486.                                          Advertisement George 
  1487. Tate hired Hal Pawluck to write an ad for DBASE 2. Hal's ad was 
  1488. ingenious. It showed a photograph of a bilge pump (the kind of 
  1489. pump that removes water from a ship's bilge). The ad's headline 
  1490. said: ``DBASE versus the Bilge Pump''. The ad went on to say that 
  1491. most database systems are like bilge pumps: they suck!
  1492.                                          That explicit ad 
  1493. appeared in Infoworld, which was a popular, concise weekly 
  1494. newspaper read by all computer experts. Suddenly, all experts 
  1495. knew that DBASE was the database-management system that claimed 
  1496. not to suck.
  1497.                                          The ad generated just 
  1498. one serious complaint ___ from the company that manufactured the 
  1499. bilge pump!
  1500.                                          George Tate offered to 
  1501. add a footnote, saying ``This bilge pump does not suck''. The 
  1502. pump manufacturer didn't like that either but stopped 
  1503. complaining.
  1504.                                          Beyond DBASE 2 The 
  1505. original DBASE 2 ran on computers using the CP/M operating 
  1506. system. It worked well. When IBM began selling the IBM PC, Wayne 
  1507. invented an IBM PC version of DBASE 2, but it was buggy.
  1508.                                          He created those early 
  1509. versions of DBASE by using assembly language. By using C instead, 
  1510. he finally created an IBM PC version that worked reliably and 
  1511. included extra commands. He called it DBASE 3.
  1512.                                          DBASE 2 and DBASE 3 were 
  1513. sold as programming languages, but many people who wanted to use 
  1514. databases didn't want to learn programming and didn't want to 
  1515. hire a programmer. So Ashton-Tate created a new version, called 
  1516. DBASE 3 PLUS, which you can control by using menus instead of 
  1517. typing programming commands.
  1518.                                          Unfortunately, the menus 
  1519. of DBASE 3 PLUS are hard to learn how to use. Also, the menus are 
  1520. incomplete: they don't let you tap the full power of DBASE 3 
  1521. PLUS. So to use DBASE 3 PLUS well, you must learn how to program 
  1522. anyway.
  1523.                                          In 1988, Ashton-Tate 
  1524. began shipping DBASE 4, which includes extra programming 
  1525. commands. Some of those commands were copied from a database 
  1526. language called Structured Query Language (SQL), which IBM 
  1527. invented for mainframes. DBASE 4 also boasted better menus than 
  1528. DBASE 3 PLUS. Unfortunately, Ashton-Tate priced DBASE 4 high: 
  1529. $795 for the plain version, $1295 for the ``developer's'' 
  1530. version.
  1531.                                          Over the years, 
  1532. Ashton-Tate became a stodgy bureaucracy. George Tate died, Wayne 
  1533. Ratliff quit, the company's list price for DBASE grew 
  1534. ridiculously high, and the company was callous to DBASE users.
  1535.                                          In 1991, Borland bought 
  1536. Ashton-Tate. In 1994, Borland began selling DBASE 5. Discount 
  1537. dealers sell it for $529.
  1538.                                          Dramatic improvements to 
  1539. DBASE have been created by other companies, who make clones of 
  1540. DBASE that outshine DBASE itself! The most popular clone is 
  1541. FOXPRO 2.6, which runs faster than DBASE, includes extra 
  1542. commands, and is marketed by Microsoft. Discount dealers have 
  1543. been selling it for just $94, but that temporary low price will 
  1544. probably rise.
  1545.  
  1546.   
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553. IF & PICK
  1554. LOOP
  1555.  
  1556. PREPARE & DATA
  1557. HOW
  1558.   Here's how to use them. . . . 
  1559.   SAY EASY uses the word SAY instead of BASIC's word PRINT, 
  1560. because SAY is briefer. If you want the computer to say the 
  1561. answer to 2+2, give this command:
  1562. SAY 2+2
  1563. The computer will say the answer:
  1564. 4
  1565.   Whenever the computer prints, it automatically prints a blank 
  1566. space afterwards but does not press the ENTER key. So if you run 
  1567. this program ___ 
  1568. SAY "LOVE"
  1569. SAY "HATE"
  1570. the computer will say:
  1571. LOVE HATE
  1572.   Here's a fancier example:
  1573. SAY "LOVE" AS 3 AT 20 15 TRIM !
  1574. The ``AS 3'' is a format: it makes the computer print just the 
  1575. first 3 letters of LOVE. The ``AT 20 15'' makes the computer 
  1576. begin printing LOVE at the screen's pixel whose X coordinate is 
  1577. 20 and whose Y coordinate is 15. The computer usually prints a 
  1578. blank space after everything, but the word TRIM suppresses that 
  1579. blank space. The exclamation point makes the computer press the 
  1580. ENTER key afterwards.
  1581.   Here's another example:
  1582. SAY TO SCREEN PRINTER HARRY
  1583. It means that henceforth, whenever you give a SAY command, the 
  1584. computer will print the answer simultaneously onto your screen, 
  1585. onto your printer, and onto a disk file named HARRY. If you ever 
  1586. want to cancel that ``SAY TO'' command, give a ``SAY TO'' command 
  1587. that contradicts it.
  1588.   GET EASY uses the word GET instead of BASIC's word INPUT, 
  1589. because GET is briefer. The command GET X makes the computer wait 
  1590. for you to input the value of X. Above the GET command, you 
  1591. typically put a SAY command that makes the computer ask a 
  1592. question.
  1593.   You can make the GET command fancy, like this:
  1594. GET X AS 3 AT 20 15 WAIT 5
  1595. The ``AS 3'' tells the computer that X will be just 3 characters; 
  1596. the computer waits for you to type just 3 characters and doesn't 
  1597. require you to press the ENTER key afterwards. The ``AT 20 15'' 
  1598. makes the computer move to pixel 20 15 before your typing begins, 
  1599. so your input appears at that part of the screen. The ``WAIT 5'' 
  1600. makes the computer wait just 5 seconds for your response. If you 
  1601. reply within 5 seconds, the computer sets TIME equal to how many 
  1602. seconds you took. If you do not reply within the 5 seconds, the 
  1603. computer sets TIME equal to -1.
  1604.                                          LET The LET statement 
  1605. resembles BASIC's. For example, you can say:
  1606. LET R=4
  1607.                                          To let R be a random 
  1608. decimal, type:
  1609. LET R=RANDOM
  1610. To let R be a random integer from 1 to 6, type:
  1611. LET R=RANDOM TO 6
  1612. To let R be a random integer from -3 to 5, type:
  1613. LET R=RANDOM FROM -3 TO 5
  1614.                                          REPEAT If you put the 
  1615. word REPEAT at the bottom of your program, the computer will 
  1616. repeat the entire program again and again, forming an infinite 
  1617. loop.
  1618.                                          SKIP If you put the word 
  1619. SKIP in the middle of your program, the computer will skip the 
  1620. bottom part of the program. SKIP is like BASIC's END or STOP.
  1621.                                          HERE In the middle of 
  1622. your program, you can say:
  1623. HERE IS FRED
  1624. An earlier line can say SKIP TO FRED. A later line can say REPEAT 
  1625. FROM FRED. The SKIP TO and REPEAT FROM are like BASIC's GO TO.
  1626.                                          IF In your program, a 
  1627. line can say:
  1628. IF X<3
  1629. Underneath that line, you must put some indented lines, which the 
  1630. computer will do if X<3.
  1631.                                          Suppose you give a 
  1632. student a test on which the score can be between 0 and 100. If 
  1633. the student's score is 100, let's make the computer say 
  1634. ``PERFECT''; if the score is below 100 but at least 70, let's 
  1635. make the computer say the score and also say ``OKAY THOUGH NOT 
  1636. PERFECT''; if the score is below 70, let's make the computer say 
  1637. ``YOU FAILED''. Here's how:
  1638. IF SCORE=100
  1639.   SAY "PERFECT"
  1640. IF SCORE<100 AND SCORE>=70
  1641.   SAY SCORE
  1642.   SAY "OKAY THOUGH NOT PERFECT"
  1643. IF SCORE<70
  1644.   SAY "YOU FAILED"
  1645.                                          To shorten the program, 
  1646. use the words NOT and BUT:
  1647. IF SCORE=100
  1648.   SAY "PERFECT"
  1649. IF NOT BUT SCORE>=70
  1650.   SAY SCORE
  1651.   SAY "OKAY THOUGH NOT PERFECT"
  1652. IF NOT
  1653.   SAY "YOU FAILED"
  1654. The phrase ``IF NOT'' is like BASIC's ELSE. The phrase ``IF NOT 
  1655. BUT'' is like BASIC's ELSE IF.
  1656.                                          PICK You can shorten 
  1657. that example even further, by telling the computer to pick just 
  1658. the first IF that's true:
  1659. PICK SCORE
  1660.   IF 100
  1661.     SAY "PERFECT"
  1662.   IF >=70
  1663.     SAY SCORE
  1664.     SAY "OKAY THOUGH NOT PERFECT"
  1665.   IF NOT
  1666.     SAY "YOU FAILED"
  1667.  
  1668.   LOOP If you put the word LOOP above indented lines, the 
  1669. computer will do those lines repeatedly. For example, this 
  1670. program makes the computer say the words CAT and DOG repeatedly:
  1671. LOOP
  1672.   SAY "CAT"
  1673.   SAY "DOG"
  1674.   This program makes the computer say 5, 8, 11, 14, and 17:
  1675. LOOP I FROM 5 BY 3 TO 17
  1676.   SAY I
  1677. That LOOP statement is like BASIC's ``FOR I = 5 TO 17 STEP 3''. 
  1678. If you omit the ``BY 3'', the computer will assume ``BY 1''. If 
  1679. you omit the ``FROM 5'', the computer will assume ``FROM 1''. If 
  1680. you omit the ``TO 17'', the computer will assume ``to infinity''.
  1681.   To make the computer count down instead of up, insert the word 
  1682. DOWN, like this:
  1683. LOOP I FROM 17 DOWN BY 3 TO 5
  1684.   PREPARE To do an unusual activity, you should PREPARE the 
  1685. computer for it. For example, if you want to use subscripted 
  1686. variables such as X(100), you should tell the computer:
  1687. PREPARE X(100)
  1688. In that example, PREPARE is like BASIC's DIM.
  1689.   DATA EASY's DATA statement resembles BASIC's. But instead of 
  1690. saying READ X, say:
  1691. LET X=NEXT
  1692.   HOW In EASY, you can give any command you wish, such as:
  1693. PRETEND YOU ARE HUMAN
  1694. If you give that command, you must also give an explanation that 
  1695. begins with the words:
  1696. HOW TO PRETEND YOU ARE HUMAN
  1697.  
  1698.                                          Interrelated features In 
  1699. the middle of a loop, you can abort the loop. To skip out of the 
  1700. loop (and progress to the rest of the program), say SKIP LOOP. To 
  1701. hop back to the beginning of the loop (to do the next iteration 
  1702. of loop), say REPEAT LOOP.
  1703.                                          Similarly, you can say 
  1704. SKIP IF (which makes the computer skip out of an IF) and REPEAT 
  1705. IF (which makes the computer repeat the IF statement, and thereby 
  1706. imitate PASCAL's WHILE).
  1707.                                          Apostrophe Like BASIC, 
  1708. EASY uses an apostrophe to begin a comment. The computer ignores 
  1709. everything to the right of an apostrophe, unless the apostrophe 
  1710. is between quotation marks or in a DATA statement.
  1711.                                          Comma If two statements 
  1712. begin with the same word, you can combine them into a single 
  1713. statement, by using a comma.
  1714.                                          For example, instead of 
  1715. saying ___ 
  1716. LET X=4
  1717. LET Y=7
  1718. you can say:
  1719. LET X=4, Y=7
  1720.                                          Instead of saying ___ 
  1721. PRETEND YOU ARE HUMAN
  1722. PRETEND GOD IS DEAD
  1723. you can say:
  1724. PRETEND YOU ARE HUMAN, GOD IS DEAD
  1725.                                          More info I stopped 
  1726. working on EASY in 1982, but I expect to continue development 
  1727. again soon. To get on my mailing list of people who want more 
  1728. details and updated information about EASY, phone me at 
  1729. 617-666-2666 or send me a postcard.
  1730. EASYEASY is a language I developed several years ago. It combines the best features of all other languages. It's easy to learn, because it uses just these twelve keywords:SAY & GETLETREPEAT & SKIPHERE
  1731.               RADICALS
  1732.   Let's examine the radical languages, beginning with the oldest 
  1733. radical ___ the oldest hippie ___ LISP.
  1734.  
  1735.                 LISP
  1736.   LISP is the only language made specifically to handle lists of 
  1737. concepts. It's the most popular language for research into 
  1738. artificial intelligence.
  1739.   It's the father of LOGO, which is ``oversimplified LISP'' and 
  1740. the most popular language for young children. It inspired PROLOG, 
  1741. which is a LISP-like language that lets you make the computer 
  1742. imitate a wise expert and become an expert system.
  1743.   Beginners in artificial intelligence love to play with LOGO and 
  1744. PROLOG, which are easier and more fun than LISP. But most 
  1745. professionals continue to use LISP because it's more powerful 
  1746. than its children.
  1747.   The original version of LISP was called LISP 1. Then came an 
  1748. improvement, called LISP 1.5 (because it wasn't different enough 
  1749. from LISP 1 to rate the title ``LISP 2''). Then came a slight 
  1750. improvement on LISP 1.5, called LISP 1.6. The newest version of 
  1751. LISP is called Common LISP; it runs on maxicomputers, 
  1752. minicomputers, and microcomputers.
  1753.   I'll explain ``typical'' LISP, which is halfway between LISP 
  1754. 1.6 and Common LISP.
  1755.   Typical LISP uses these symbols:
  1756. BASIC LISP
  1757. 5+2   (PLUS 5 2)
  1758. 5-2   (DIFFERENCE 5 2)
  1759. 5*2   (TIMES 5 2)
  1760. 5/2   (QUOTIENT 5 2)
  1761. 5^2   (EXPT 5 2)
  1762. "LOVE"'LOVE Older versions say: (QUOTE LOVE)
  1763.   If you want the computer to add 5 and 2, just type:
  1764. (PLUS 5 2)
  1765. When you press the ENTER key at the end of that line, the 
  1766. computer will print the answer. (You do not have to say PRINT or 
  1767. any other special word.) The computer will print:
  1768. 7
  1769.   If you type ___ 
  1770. (PLUS 1 3 1 1)
  1771. the computer will add 1, 3, 1, and 1 and print:
  1772. 6
  1773.   If you type ___ 
  1774. (DIFFERENCE 7 (TIMES 2 3))
  1775. the computer will find the difference between 7 and 2*3 and 
  1776. print:
  1777. 1
  1778.   If you type ___ 
  1779. 'LOVE
  1780. the computer will print:
  1781. LOVE
  1782. Notice that you must type an apostrophe before LOVE but must not 
  1783. type an apostrophe afterwards. The apostrophe is called a single 
  1784. quotation mark (or a quote).
  1785.                                          You can put a quote in 
  1786. front of a word (such as 'LOVE) or in front of a parenthesized 
  1787. list of words, such as:
  1788. '(LAUGH LOUDLY)
  1789. That makes the computer print:
  1790. (LAUGH LOUDLY)
  1791.                                          LISP 1, LISP 1.5, and 
  1792. LISP 1.6 don't understand the apostrophe. On those old versions 
  1793. of LISP, say (QUOTE LOVE) instead of 'LOVE, and say (QUOTE (LAUGH 
  1794. LOUDLY)) instead of '(LAUGH LOUDLY).
  1795.                                          The theory of lists LISP 
  1796. can handle lists. Each list must begin and end with a 
  1797. parenthesis. Here's a list of numbers: (5 7 4 2). Here's a list 
  1798. of words: (LOVE HATE WAR PEACE DEATH).
  1799.                                          Here's a list of numbers 
  1800. and words: (2 WOMEN KISS 7 MEN). That list has five items: 2, 
  1801. WOMEN, KISS, 7, and MEN.
  1802.                                          Here's a list of four 
  1803. items: (HARRY LEMON (TICKLE MY TUBA TOMORROW AT TEN) RUSSIA). The 
  1804. first item is HARRY; the second is LEMON; the third is a list; 
  1805. the fourth is RUSSIA.
  1806.                                          In a list, the first 
  1807. item is called the CAR, and the remainder of the list is called 
  1808. the CDR (pronounced ``could er'' or ``cudder'' or ``coo der''). 
  1809. For example, the CAR of (SAILORS DRINK WHISKEY) is SAILORS, and 
  1810. the CDR is (DRINK WHISKEY).
  1811.                                          To make the computer 
  1812. find the CAR of (SAILORS DRINK WHISKEY), type this:
  1813. (CAR '(SAILORS DRINK WHISKEY))
  1814. The computer will print:
  1815. SAILORS
  1816.                                          If you type ___ 
  1817. (CDR '(SAILORS DRINK WHISKEY))
  1818. the computer will print:
  1819. (DRINK WHISKEY)
  1820.                                          If you type ___ 
  1821. (CAR (CDR '(SAILORS DRINK WHISKEY)))
  1822. the computer will find the CAR of the CDR of (SAILORS DRINK 
  1823. WHISKEY). Since the CDR of (SAILORS DRINK WHISKEY) is (DRINK 
  1824. WHISKEY), whose CAR is DRINK, the computer will print:
  1825. DRINK
  1826.                                          You can insert an extra 
  1827. item at the beginning of a list, to form a longer list. For 
  1828. example, you can insert MANY at the beginning of (SAILORS DRINK 
  1829. WHISKEY), to form (MANY SAILORS DRINK WHISKEY). To do that, tell 
  1830. the computer to CONStruct the longer list, by typing:
  1831. (CONS 'MANY '(SAILORS DRINK WHISKEY))
  1832. The computer will print:
  1833. (MANY SAILORS DRINK WHISKEY)
  1834.                                          Notice that CONS is the 
  1835. opposite of CAR and CDR. The CONS combines MANY with (SAILORS 
  1836. DRINK WHISKEY) to form (MANY SAILORS DRINK WHISKEY). The CAR and 
  1837. CDR break down (MANY SAILORS DRINK WHISKEY), to form MANY and 
  1838. (SAILORS DRINK WHISKEY).
  1839.   Variables To make X stand for the number 7, say:
  1840. (SETQ X 7)
  1841. Then if you say ___ 
  1842. (PLUS X 2)
  1843. the computer will print 9.
  1844.   To make Y stand for the word LOVE, say:
  1845. (SETQ Y 'LOVE)
  1846. Then if you say ___ 
  1847. Y
  1848. the computer will say:
  1849. LOVE
  1850.   To make STOOGES stand for the list (MOE LARRY CURLEY), say:
  1851. (SETQ STOOGES '(MOE LARRY CURLEY))
  1852. Then if you say ___ 
  1853. STOOGES
  1854. the computer will say:
  1855. (MOE LARRY CURLEY)
  1856. To find the first of the STOOGES, say:
  1857. (CAR STOOGES)
  1858. The computer will say:
  1859. MOE
  1860.   Your own functions You can define your own functions. For 
  1861. example, you can define (DOUBLE X) to be 2*X, by typing this:
  1862. (DEFUN DOUBLE (X)
  1863.        (TIMES 2 X)
  1864. )
  1865. Then if you say ___ 
  1866. (DOUBLE 3)
  1867. the computer will print:
  1868. 6
  1869.   REPEAT Let's define REPEAT to be a function, so that (REPEAT 
  1870. 'LOVE 5) is (LOVE LOVE LOVE LOVE LOVE), and (REPEAT 'KISS 3) is 
  1871. (KISS KISS KISS), and (REPEAT 'KISS 0) is ().
  1872.   If N is 0, we want (REPEAT X N) to be ().
  1873.   If N is larger than 0, we want (REPEAT X N) to be a list of N 
  1874. X's. That's X followed by N-1 more X's. That's the CONS of X with 
  1875. a list of N-1 more X's. That's the CONS of X with (REPEAT X 
  1876. (DIFFERENCE N 1)). That's (CONS X (REPEAT X (DIFFERENCE N 1))). 
  1877. That's (CONS X (REPEAT X (SUB1 N))), since (SUB1 N) means N-1 in 
  1878. LISP.
  1879.   You can define the answer to (REPEAT X N) as follows: if N is 
  1880. ), the answer is (); if N is not 0, the answer is (CONS X (REPEAT 
  1881. X (SUB 1 N))). Here's how to type that definition:
  1882. (DEFUN REPEAT (X N)
  1883.        (COND
  1884.              ((ZEROP N) ())
  1885.              (T (CONS X (REPEAT X (SUB1 N))))
  1886.        )
  1887. )
  1888. The top line says you're going to DEfine a FUNction called REPEAT 
  1889. (X N). The next line says the answer depends on CONDitions. The 
  1890. next line gives one of those conditions: if N is ZERO, the answer 
  1891. is (). The next line says: otherwise, the value is (CONS X 
  1892. (REPEAT X (SUB1 N))). The next line closes the parentheses opened 
  1893. in the second line. The bottom line closes the parentheses opened 
  1894. in the top line.
  1895.                                          Then if you type ___ 
  1896. (REPEAT 'LOVE 5)
  1897. the computer will print:
  1898. (LOVE LOVE LOVE LOVE LOVE)
  1899.                                          The definition is almost 
  1900. circular: the definition of REPEAT assumes you already know what 
  1901. REPEAT is. For example, (REPEAT 'KISS 3) is defined as the CONS 
  1902. of KISS with the following: (REPEAT 'KISS 2), which is defined as 
  1903. the CONS of KISS with the following: (REPEAT 'KISS 1), which is 
  1904. defined as the CONS of KISS with the following (REPEAT 'KISS 1), 
  1905. which is defined as the CONS of KISS with the following (REPEAT 
  1906. 'KISS 0), which is defined as ().
  1907.                                          That kind of definition, 
  1908. which is almost circular, is called recursive. You can say ``The 
  1909. definition of REPEAT is recursive'', or ``REPEAT is defined 
  1910. recursively'', or ``REPEAT is defined by recursion'', or ``REPEAT 
  1911. is defined by induction'', or ``REPEAT is a recursive function''. 
  1912. LISP was the first popular language that allowed recursive 
  1913. definitions.
  1914.                                          When the computer uses a 
  1915. recursive definition, the computer refers to the definition 
  1916. repeatedly before getting out of the circle. Since the computer 
  1917. repeats, it's performing a loop. In traditional BASIC and 
  1918. FORTRAN, the only way to make the computer perform a loop is to 
  1919. say GO TO or FOR or DO. Although LISP contains a go-to command, 
  1920. LISP programmers avoid it and write recursive definitions 
  1921. instead.
  1922.                                          ITEM As another example 
  1923. of recursion, let's define the function ITEM so that (ITEM N X) 
  1924. is the Nth item in list X, and so that (ITEM 3 '(MANY SAILORS 
  1925. DRINK WHISKEY)) is the 3rd item of (MANY SAILORS DRINK WHISKEY), 
  1926. which is DRINK.
  1927.                                          If N is 1, (ITEM N X) is 
  1928. the first item in X, which is the CAR of X, which is (CAR X).
  1929.                                          If N is larger than 1, 
  1930. (ITEM N X) is the Nth item in X. That's the (N-1)th item in the 
  1931. CDR of X. That's (ITEM (SUB1 N) (CDR X)).
  1932.                                          So define (ITEM N X) as 
  1933. follows: if N is 1, the answer is (CAR X); if N is not 1, the 
  1934. answer is (ITEM (SUB 1 N) (CDR X)). Here's what to type:
  1935. (DEFUN ITEM (N X)
  1936.        (COND
  1937.              ((ONEP N) ())
  1938.              (T (ITEM (SUB1 N) (CDR X)))
  1939.        )
  1940. )
  1941. If your computer doesn't understand (ONEP N), say (EQUAL 1 N) 
  1942. instead.
  1943.                SNOBOL
  1944.   SNOBOL lets you analyze strings more easily than any other 
  1945. language. It can handle numbers also.
  1946.   Simple example Here's a simple SNOBOL program:
  1947.         A = -2
  1948.         B = A + 10.6
  1949.         C = "BODY TEMPERATURE IS 9" B
  1950.         OUTPUT = "MY " C
  1951. END
  1952.   When you type the program, indent each line except END. Indent 
  1953. at least one space; you can indent more spaces if you wish. Put 
  1954. spaces around the symbol =, the symbol +, and other operations.
  1955.   The first line says A is the integer -2. The next line says B 
  1956. is the real number 8.6. The next line says C is the string ``BODY 
  1957. TEMPERATURE IS 98.6''. The next line makes the computer print:
  1958. BODY TEMPERATURE IS 98.6
  1959.   In SNOBOL, a variable's name can be short (like A or B or C) or 
  1960. as long as you wish. The variable's name can even contain 
  1961. periods, like this:
  1962. NUMBER.OF.BULLIES.I.SQUIRTED
  1963.   Looping This program's a loop:
  1964. FRED    OUTPUT = "CAT"
  1965.         OUTPUT = "DOG" :(FRED)
  1966. END
  1967. The first line (whose name is FRED) makes the computer print:
  1968. CAT
  1969. The next line makes the computer print ___ 
  1970. DOG
  1971. and then go to FRED. Altogether the computer will print:
  1972. CAT
  1973. DOG
  1974. CAT
  1975. DOG
  1976. CAT
  1977. DOG
  1978. etc.
  1979.   Replacing SNOBOL lets you easily replace one phrase by another.
  1980.         X = "SIN ON A PIN WITH A DIN"
  1981.         X "IN" = "UCK"
  1982.         OUTPUT = X
  1983. END
  1984. The first line says X is the string ``SIN ON A PIN WITH A DIN''. 
  1985. The next line says: in X, replace the first ``IN'' by ``UCK''. So 
  1986. X becomes ``SUCK ON A PIN WITH A DIN''. The next line says the 
  1987. output is X, so the computer will print:
  1988. SUCK ON A PIN WITH A DIN
  1989.   That program changed the first ``IN'' to ``UCK''. Here's how to 
  1990. change every ``IN'' to ``UCK'':
  1991.         X = "SIN ON A PIN WITH A DIN"
  1992.         X "IN" = "UCK"
  1993.         X "IN" = "UCK"
  1994.         X "IN" = "UCK"
  1995.         OUTPUT = X
  1996. END
  1997. The first line says X is ``SIN ON A PIN WITH A DIN''. The second 
  1998. line replaces an ``IN'' by ``UCK'', so X becomes ``SUCK ON A PIN 
  1999. WITH A DIN''. The next line replaces another ``IN'' by ``UCK'', 
  2000. so X becomes ``SUCK ON A PUCK WITH A DIN''. The next line 
  2001. replaces another ``IN'', so X becomes ``SUCK ON A PUCK WITH A 
  2002. DUCK'', which the
  2003. next line prints.
  2004.                                          This program does the 
  2005. same thing:
  2006.         X = "SIN ON A PIN WITH A DIN"
  2007. LOOP    X "IN" = "UCK" :S(LOOP)
  2008.         OUTPUT = X
  2009. END
  2010. The first line says X is ``SIN ON A PIN WITH A DIN''. The next 
  2011. line replaces ``IN'' successfully, so X becomes ``SUCK ON A PIN 
  2012. WITH A DIN''. At the end of the line, the :S(LOOP) means: if 
  2013. Successful, go to LOOP. So the computer goes back to LOOP. The 
  2014. computer replaces ``IN'' successfully again, so X becomes ``SUCK 
  2015. ON A PUCK WITH A DIN'', and the computer goes back to LOOP. The 
  2016. computer replaces ``IN'' successfully again, so X becomes ``SUCK 
  2017. ON A PUCK WITH A DUCK'', and the computer goes back to LOOP. The 
  2018. computer does not succeed. So the computer ignores the :S(LOOP) 
  2019. and proceeds instead to the next line, which prints:
  2020. SUCK ON A PUCK WITH A DUCK
  2021.                                          Deleting This program 
  2022. deletes the first ``IN'':
  2023.         X = "SIN ON A PIN WITH A DIN"
  2024.         X "IN" =
  2025.         OUTPUT = X
  2026. END
  2027. The second line says to replace an ``IN'' by nothing, so the 
  2028. ``IN'' gets deleted. X becomes ``S ON A PIN WITH A DIN'', which 
  2029. the computer will print.
  2030.                                          This program deletes 
  2031. every ``IN'':
  2032.         X = "SIN ON A PIN WITH A DIN"
  2033. LOOP    X "IN" = :S(LOOP)
  2034.         OUTPUT = X
  2035. END
  2036. The computer will print:
  2037. S ON A P WITH A D
  2038.                                          Counting Let's count how 
  2039. often ``IN'' appears in ``SIN ON A PIN WITH A DIN''. To do that, 
  2040. delete each ``IN''; but each time you delete one, increase the 
  2041. COUNT by 1:
  2042.         X = "SIN ON A PIN WITH A DIN"
  2043.         COUNT = 0
  2044. LOOP    X "IN" = :F(ENDING)
  2045.         COUNT = COUNT + 1 :(LOOP)
  2046. ENDING  OUTPUT = COUNT
  2047. END
  2048. The third line tries to delete an ``IN'': if successful, the 
  2049. computer proceeds to the next line, which increases the COUNT and 
  2050. goes back to LOOP; if failing (because no ``IN'' remains), the 
  2051. computer goes to ENDING, which prints the COUNT. The computer 
  2052. will print:
  2053. 3
  2054.                                          How SNOBOL developed At 
  2055. MIT during the 1950's, Noam Chomsky invented a notation called 
  2056. transformational-generative grammar, which helps linguists 
  2057. analyze English and translate between English and other 
  2058. languages. His notation was nicknamed ``linguist's algebra'', 
  2059. because it helped linguists just as algebra helped scientists. (A 
  2060. decade later, he became famous for also starting the rebellion 
  2061. against the Vietnam War.)
  2062.                                          Chomsky's notation was 
  2063. for pencil and paper. In 1957 and 1958, his colleague Victor 
  2064. Yngve developed a computerized version of Chomsky's notation: the 
  2065. computerized version was a language called COMIT. It was 
  2066. nicknamed ``linguist's FORTRAN'', because it helped linguists 
  2067. just as FORTRAN helped engineers.
  2068.   COMIT manipulated strings of words. In 1962 at Bell Telephone 
  2069. Laboratories (Bell Labs), Chester Lee invented a variant called 
  2070. the Symbolic Communication Language (SCL), which manipulated 
  2071. strings of mathematical symbols instead of words and helped 
  2072. mathematicians do abstract mathematics.
  2073.   A team at Bell Labs decided to invent a language similar to 
  2074. SCL, but easier to learn and including features from COMIT. At 
  2075. first, they called their new language ``SCL7'', because it 
  2076. resembled SCL. Then they changed its name to ``SEXI'' (which 
  2077. stands for String EXpression Interpreter), but the management of 
  2078. Bell Labs didn't like sex. Then, as a joke, they named it SNOBOL, 
  2079. using the flimsy excuse that SNOBOL stands for StriNg-Oriented 
  2080. symBOlic Language.
  2081.   Cynics jeered that SNOBOL didn't have ``a snowball's chance in 
  2082. Hell''. But the cynics were wrong, and SNOBOL became popular. It 
  2083. was used mainly for writing programs that translate between 
  2084. computer languages. (For example, you could write a SNOBOL 
  2085. program that translates FORTRAN into BASIC.)
  2086.   Which is better: COMIT or SNOBOL? People who like Chomsky's 
  2087. notation (such as linguists) prefer COMIT. People who like 
  2088. algebra (such as scientists) prefer SNOBOL.
  2089.   SNOBOL's supporters were more active than COMIT's: they 
  2090. produced SNOBOL 2, SNOBOL 3, SNOBOL 4, and SNOBOL 4B, taught 
  2091. SNOBOL to the newest computers, wrote many books about SNOBOL, 
  2092. and emphasized that SNOBOL can solve any problem about strings, 
  2093. even if the problem had nothing to do with linguistics. They won: 
  2094. most people use SNOBOL instead of COMIT, though COMIT might still 
  2095. make a comeback.
  2096.   Today, most versions of SNOBOL are named after baseball 
  2097. pitching methods ___ such as FASBOL, SLOBOL, and SPITBOL. 
  2098. (SPITBOL stands for SPeedy ImplemenTation of snoBOL.)
  2099.                                                   APL
  2100.                              APL lets you manipulate lists of 
  2101. numbers more easily than any other language.
  2102.                              APL uses special characters that 
  2103. aren't on a normal keyboard.
  2104.                              To compute 8+9, type this:
  2105.       8+9
  2106. Notice the line is indented. Whenever it's your turn to type, the 
  2107. computer automatically indents the line for you.
  2108.                              When you press the RETURN key at the 
  2109. end of that line, the computer will print the answer. (You don't 
  2110. have to say PRINT or any other special word.) The computer will 
  2111. print:
  2112. 17
  2113.                              Scalar operators APL uses these 
  2114. scalar operators:
  2115. APL name                           SymbolMeaning
  2116. PLUS                               A+B   add
  2117. identity                            +B   same as just B
  2118. MINUS                              A-B   subtract
  2119. negative                            -B   negative
  2120. TIMES                              AxB   multiply
  2121. signum                              xB   1 if B>0; -1 if B<0; 0 
  2122. if B=0
  2123. DIVIDE                             A÷B   divide
  2124. reciprocal                          ÷B   1 divided by B
  2125. POWER                              A*B   A raised to the Bth 
  2126. power; AB
  2127. exponential                         *B   e raised to the Bth 
  2128. power, where e is 2.718281828459045
  2129. LOG                                A*°B  logarithm, base A, of B
  2130. natural log                         *°B  logarithm, base e, of B
  2131. CEILING                             ┌B   B rounded up to an 
  2132. integer
  2133. maximum                            A┌B   A or B, whichever is 
  2134. larger
  2135. FLOOR                               └B   B rounded down to an 
  2136. integer
  2137. minimum                            A└B   A or B, whichever is 
  2138. smaller
  2139. MAGNITUDE                           │B   the absolute value of B
  2140. residue                            A│B   the remainder when you 
  2141. divide A into B; so 4│19 is 3
  2142. FACTORIAL                           !B   1 times 2 times 3 times 
  2143. 4 times . . . times B
  2144. combinations                       A!B   how many A-element 
  2145. subsets you can form from a set of B
  2146. ROLL                                ?B   a random integer from 1 
  2147. to B
  2148. deal                               A?B   list of A random 
  2149. integers, each from 1 to B, no duplicates
  2150. PI TIMES                            °B   π times B
  2151. circular                           A°B   sin B if A=1arcsinB if 
  2152. A=-1                                                           
  2153. square root of 1+B² if A= 4
  2154.                                          cos B if A=2arccosB if 
  2155. A=-2                                                           
  2156. square root of 1-B²  if A= 0
  2157.                                          tan B if A=3arctanB if 
  2158. A=-3                                                           
  2159. square root of B²-1  if A=-4
  2160.                                          sinh B if A=5arcsinhB if 
  2161. A=-5
  2162.                                          cosh B if A=6arccoshB if 
  2163. A=-6
  2164.                                          tanh B if A=7arctanhB if 
  2165. A=-7
  2166. EQUAL                              A=B   1 if A equals B;  
  2167. otherwise 0
  2168. not equal                          A=/B  1 if A is not equal to 
  2169. B;                                                         
  2170. otherwise 0
  2171. LESS                               A<B   1 if A is less than 
  2172. B;otherwise 0
  2173. less or equal                      A≤B   1 if A is less than or 
  2174. equal to B;                                                
  2175. otherwise 0
  2176. GREATER                            A>B   1 if A is greater than 
  2177. B;                                                         
  2178. otherwise 0
  2179. gr. or equal                       A≥B   1 if A is greater than 
  2180. or equal to B;                                             
  2181. otherwise 0
  2182. AND                                A^B   1 if A and B are both 
  2183. 1;otherwise 0
  2184. nand                               A^~B  1 if A and B are not 
  2185. both 1;                                                    
  2186. otherwise 0
  2187. OR                                 AvB   1 if A or B is 1; 
  2188. otherwise 0
  2189. nor                                Av~B  1 if neither A nor B is 
  2190. 1;                                                         
  2191. otherwise 0
  2192. NOT                                 ~B   1 if B is 0;      
  2193. otherwise 0
  2194. To make the symbol *°, type the symbol *, then press the 
  2195. BACKSPACE key, then type the symbol °.
  2196.   Order of operations Unlike all other popular languages, APL 
  2197. makes the computer do all calculations from right to left. For 
  2198. example, if you type ___ 
  2199.       2x3+5
  2200. the computer will start with 5, add 3 (to get 8), and then 
  2201. multiply by 2 (to get 16). The computer will print:
  2202. 16
  2203. In BASIC and most other languages, the answer would be 11 
  2204. instead.
  2205.   If you type ___ 
  2206.       9-4-3
  2207. the computer will start with 3, subtract it from 4 (to get 1), 
  2208. and then subtract from 9 (to get 8). The computer will print:
  2209. 8
  2210. In most other languages, the answer would be 2 instead.
  2211.   You can use parentheses. Although 9-4-3 is 8, (9-4)-3 is 2.
  2212.   Compare these examples:
  2213. -4+6 is -10
  2214. -4+6 is   2
  2215. In both examples, the 4 is preceded by a negative sign; but in 
  2216. the second example, the negative sign is raised, to be as high as 
  2217. the 4. (To make the raised negative, tap the 2 key while holding 
  2218. down the SHIFT key. To make a regular negative, tap the + key 
  2219. while holding down the SHIFT key.) The first example makes the 
  2220. computer start with 6, add 4 (to get 10), and then negate it (to 
  2221. get -10). The second example makes the computer start with 6 and 
  2222. add -4, to get 2.
  2223.   Double precision APL is super-accurate. It does all 
  2224. calculations by using double precision.
  2225.   Variables You can use variables:
  2226.       X
  2227.       X+2
  2228. The first line says X is 3. The second line makes the computer 
  2229. print X+2. The computer will print:
  2230. 5
  2231.   A variable's name can be long: up to 77 letters and digits. The 
  2232. name must begin with a letter.
  2233.   Vectors A variable can stand for a list of numbers:
  2234.       Y 2 8
  2235.       Y+1
  2236. The first line says Y is the vector 5 2 8. The next line makes 
  2237. the computer add 1 to each item and print:
  2238. 6  3  9
  2239.   This program prints the same answer:
  2240.       5 2 8+1
  2241. The computer will print:
  2242. 6  3  9
  2243.                              This program prints the same answer:
  2244.       1+5 2 8
  2245.                              You can add a vector to another 
  2246. vector:
  2247.       A 2.1 6
  2248.       B 2.8 -7
  2249.       A+B
  2250. The computer will add 5 to 3, and 2.1 to 2.8, and 6 to -7, and 
  2251. print:
  2252. 8  4.9  -1
  2253.                              This program prints the same answer:
  2254.       5 2.1 6+3 2.8 -7
  2255.                              This program prints the same answer:
  2256.       A 2.1 6
  2257.       B 2.8 -7
  2258.       CA+B
  2259.       C
  2260.                              Here's something different:
  2261.       X 2 3
  2262.       +/X
  2263. The first line says X is the vector 4 2 3. The next line makes 
  2264. the computer print the sum, 9.
  2265.                              This program prints the same answer:
  2266.       Y+/4 2 3
  2267.       Y
  2268.                              You can combine many ideas on the 
  2269. same line, but remember that the computer goes from right to 
  2270. left:
  2271.       219-1 4 3+6x+/5 1 3x2 4 7
  2272. The computer will start with 2 4 7, multiply it by 5 1 3 (to get 
  2273. 10 4 21), find the sum (which is 35), multiply by 6 (to get 210), 
  2274. add 1 4 3 (to get 211 214 213), and then subtract from 219 (to 
  2275. get 8 5 6). The computer will print:
  2276. 8  5  6
  2277.                              Each of APL's scalar operators works 
  2278. like addition. Here are examples:
  2279. 2 4 10x3 7 9                       is 6 28 90
  2280. ÷2 4 10                            is .5 .25 .1
  2281. -2 4 10                            is -2 -4 -10
  2282. x/2 4 10                           is 2x4x10, which is 80
  2283. -/9 5 3                            is 9-5-3, which is 7 (since 
  2284. the computer works from right to left)
  2285. └/6.1 2.7 4.9                      is 6.1└2.7└4.9, which is 2.7 
  2286. (since └ means minimum)
  2287. └6.1 2.7 4.9                     is └6.1 then └2.7 then └4.9, 
  2288. which is 6 2 4 (since └ means floor)
  2289.                              Vector operators Here are vector 
  2290. operators; the examples assume V is 8 5 6:
  2291. APL name                           Symbol  Value   Reason
  2292. SHAPE                               pV     3       V has 3 items
  2293. reshape                            7pV     8 5 6 8 5 6 8make 7 
  2294. items from V
  2295. REVERSE                             °│V    6 5 8   reverse V
  2296. rotate                             1°│V    5 6 8   rotate V, by 
  2297. beginning after the 1st item
  2298. GENERATE                            i3     1 2 3   count up to 3
  2299. index of                           Vi5     2       in V, find 5; 
  2300. it's the 2nd item
  2301. TAKE                               2V     8 5     the first 2 
  2302. items from V
  2303. drop                               2V     6       omit the first 
  2304. two items from V
  2305. SUBSCRIPT                          V[2]    5       V's 2nd item
  2306. catenate                           V,9 4   8 5 6 9 4V followed by 
  2307. 9 4
  2308. COMPRESS                           1 0 1/V 8 6     take part of 
  2309. V, using this pattern: take, omit, take
  2310. expand                             1 0 0 1 1\V8 0 0 5 6insert 
  2311. zeros into V, using this pattern:
  2312.                                                    item, 0, 0, 
  2313. item, item
  2314. GRADE UP                           ■│V     2 3 1   here are V's 
  2315. numbers in increasing order:
  2316.                                                    5 (V's 2nd 
  2317. number), 6 (V's 3rd), 8 (V's 1st)
  2318. grade down                         ■│V     1 3 2   here are V's 
  2319. numbers in decreasing order:
  2320.                                                    8 (V's 1st 
  2321. number), 6 (V's 3rd), 5 (V's 2nd)
  2322. DECODE                             10┴V    856     8, times 10, 
  2323. plus 5, times 10, plus 6
  2324. encode                             10┬8568 5 6   opposite of 
  2325. decode
  2326. MEMBER                             5εV     1       search for 5 
  2327. in V (1=found, 0=missing)
  2328.                              Love or hate? Some programmers love 
  2329. APL, because its notation is brief. Other programmers hate it, 
  2330. because its notation is hard for a human to read. The haters are 
  2331. winning, and the percentage of programmers using APL is 
  2332. decreasing.
  2333.                 LOGO
  2334.   LOGO began in 1967, during an evening at Dan Bobrow's home in 
  2335. Belmont, Massachusetts.
  2336.   Dan had gotten his Ph.D. from MIT and was working for a company 
  2337. called Bolt, Beranek, and Newman (BBN). In his living room were 
  2338. three of his colleagues from BBN (Wally Feurzeig, Cynthia 
  2339. Solomon, and Dick Grant) and an MIT professor: Seymour Papert.
  2340.   BBN had tried to teach young kids how to program by using BBN's 
  2341. own language (TELCOMP), which was a variation of JOSS. BBN had 
  2342. asked Professor Seymour Papert for his opinion. The group was all 
  2343. gathered in Dan's house to hear Seymour's opinion.
  2344.   Seymour chatted with the group, and the entire group agreed 
  2345. with Seymour on several points. First, TELCOMP was not a great 
  2346. language for kids. It placed too much emphasis on mathematical 
  2347. formulas. The group agreed that instead of struggling with math, 
  2348. the kids ought to have more fun by programming the computer to 
  2349. handle strings instead.
  2350.   The group also agreed that the most sophisticated language for 
  2351. handling strings was LISP, but that LISP was too complex for 
  2352. kids.
  2353.   The group concluded that a new, simplified LISP should be 
  2354. invented for kids, and that it should be called ``LOGO''.
  2355.   That's how LOGO began. Professor Seymour Papert was the guiding 
  2356. light, and all the other members of the group gave helpful input 
  2357. during the conversation.
  2358.   That night, after his guests left, Dan went to the terminal in 
  2359. his bedroom and started programming the computer to understand 
  2360. LOGO. Specifically, he wrote a LISP program that explained to the 
  2361. computer how to handle LOGO. That's how LOGO was born.
  2362.   Work on LOGO continued. The three main researchers who 
  2363. continued improving LOGO were Seymour (the MIT guru), Wally (from 
  2364. BBN), and Cynthia (also from BBN). LOGO resembled LISP but 
  2365. required fewer parentheses.
  2366.   After helping BBN for a year, Seymour returned to MIT. Cynthia 
  2367. and several other BBN folks worked with him at MIT's Artificial 
  2368. Intelligence Laboratory to improve LOGO.
  2369.                                          Turtles At first, LOGO 
  2370. was as abstract and boring as most other computer languages. But 
  2371. in the spring of 1970, a strange creature walked into the LOGO 
  2372. lab. It was a big yellow mechanical turtle. It looked like ``half 
  2373. a grapefruit on wheels'' and had a pen in its belly:
  2374. It also had a horn, feelers, and several other fancy attachments. 
  2375. To use it, you put paper all over the floor and then programmed 
  2376. it to roll across the paper. As it rolled, the pen in its belly 
  2377. drew pictures on the paper. The turtle was controlled remotely by 
  2378. a big computer programmed in LOGO.
  2379.                                          Suddenly, LOGO became a 
  2380. fun language whose main purpose was to control the turtle. Kids 
  2381. watching the turtle screamed with delight and wanted to learn how 
  2382. to program it. LOGO became a favorite programming game for kids. 
  2383. Even kids who were just 7 years old started programming in LOGO. 
  2384. Those kids were barely old enough to read, but reading and 
  2385. writing were not prerequisites for learning how to program in 
  2386. LOGO. All the kids had to know was that ``FD 3'' made the turtle 
  2387. go forward 3 steps, and ``RT 30'' made the turtle turn to the 
  2388. right 30 degrees.
  2389.                                          As for the rest of LOGO 
  2390. ___ all that abstract stuff about strings and numbers and 
  2391. LISP-like lists ___ the kids ignored it. They wanted to use just 
  2392. the commands ``FD'' and ``RT'' that moved the turtle.
  2393.                                          The U.S. Government's 
  2394. National Science Foundation donated money, to help MIT improve 
  2395. LOGO further. Many kids came into the LOGO lab to play with the 
  2396. turtles.
  2397.                                          The turtles were 
  2398. expensive, and so were the big computers that controlled them. To 
  2399. let more kids use LOGO, the first problem was to reduce the cost 
  2400. of the turtle and its controlling computer.
  2401.                                          During the early 1970's, 
  2402. computer screens got dramatically cheaper. To save money, MIT 
  2403. stopped building mechanical turtles and instead bought cheap 
  2404. computer screens that showed pictures of turtles. Those pictures 
  2405. were called ``mock turtles''.
  2406.                                          Cheaper computers The 
  2407. original version of LOGO was done on BBN's expensive weird 
  2408. computer (the MTS 940). Later versions were done on the PDP-1 (in 
  2409. 1968), the PDP-10 (in 1970), and finally on a cheaper computer: 
  2410. the PDP-11 minicomputer (in 1972).
  2411.                                          At the end of the 
  2412. 1970's, companies such as Apple and Radio Shack began selling 
  2413. microcomputers, which were even cheaper. MIT wanted to put LOGO 
  2414. on microcomputers but ran out of money to pay for the research.
  2415.                                          Texas Instruments (TI) 
  2416. came to the rescue. . . . 
  2417.   TI LOGO TI agreed to pay MIT to research how to put LOGO on 
  2418. TI's microcomputers (the TI-99/4 and the TI-99/4A).
  2419.   TI and MIT thought the job would be easy, since MIT had already 
  2420. written a PASCAL program that made the computer understand LOGO, 
  2421. and since TI had already written a version of PASCAL for the CPU 
  2422. chip inside the TI-99/4. Initially, MIT was worried because the 
  2423. PASCAL program running on MIT's PDP-10 computer handled LOGO too 
  2424. slowly; but TI claimed TI's PASCAL was faster than the PDP-10's 
  2425. and that LOGO would therefore run fast enough on the TI.
  2426.   TI was wrong. TI's PASCAL couldn't make LOGO run fast enough, 
  2427. and TI's PASCAL also required too much RAM. So TI had to take 
  2428. MIT's research (on the PDP-10) and laboriously translate it into 
  2429. TI's assembly language, by hand.
  2430.   The hand translation went slower that TI expected. TI became 
  2431. impatient and took a short-cut: it omitted parts of LOGO, such as 
  2432. decimals. TI began selling its version of LOGO, which understood 
  2433. just integers.
  2434.   MIT Apple LOGO After TI started selling its LOGO, the MIT group 
  2435. invented a version of LOGO for the Apple. The Apple version 
  2436. included decimals. But alas, the Apple version omitted 
  2437. ``sprites'' (which are animated creatures that carry objects 
  2438. across the screen) because Apple's hardware couldn't handle 
  2439. sprites fast enough. (TI's hardware was fancier and did handle 
  2440. sprites.)
  2441.   MIT wanted to sell the Apple version to schools since more 
  2442. schools owned Apples than TI computers. But if MIT were to make 
  2443. lots of money from selling the Apple version, MIT might get into 
  2444. legal trouble, since MIT was supposed to be non-profit. And 
  2445. anyway, who ``owned'' LOGO? Possible contenders were:
  2446. MIT, which did most of the research
  2447. BBN, which trademarked the name ``LOGO'' and did the early 
  2448. research
  2449. Uncle Sam, whose National Science Foundation paid for much 
  2450. research
  2451. TI, which also paid for much research
  2452.   Eventually, MIT solved the legal problems and sold the rights 
  2453. for ``MIT Apple LOGO'' to two companies: Krell and Terrapin.
  2454.   Krell was strictly a marketing company. It sold MIT Apple LOGO 
  2455. to schools but made no attempt to improve LOGO further.
  2456.   Terrapin, on the other hand, was a research organization that 
  2457. had built mechanical turtles for several years. Terrapin hired 
  2458. some MIT graduates to improve LOGO further.
  2459.                                          LCSI versus competitors 
  2460. Back when MIT was asking its lawyers to determine who owned Apple 
  2461. LOGO, a group of MIT's faculty and students became impatient. The 
  2462. group, headed by Cynthia Solomon (one of the original inventors 
  2463. of LOGO), left MIT and formed a company called LOGO Computer 
  2464. Systems Incorporated (LCSI). That company invented its own 
  2465. version of LOGO for the Apple.
  2466.                                          LCSI became quite 
  2467. successful. Apple, IBM, Atari, and Microsoft all hired LCSI to 
  2468. write versions of LOGO. Commodore hired Terrapin instead.
  2469.                                          Today, if you have an 
  2470. Apple 2c (or 2e or 2+), you can buy either the official Apple 
  2471. LOGO (sold by Apple Computer Inc. and created by LCSI), or 
  2472. ``Terrapin LOGO for the Apple'' (sold by Terrapin), or the 
  2473. original ``MIT LOGO for the Apple'' (sold by Krell).
  2474.                                          Krell is becoming less 
  2475. popular. That leaves just two major players: Terrapin and LCSI. 
  2476. Generally speaking, LCSI's versions of LOGO are daring ___ LCSI 
  2477. tried wild experiments ___ while Terrapin's versions of LOGO are 
  2478. conservative ___ closer to the MIT original.
  2479.                                          The two companies have 
  2480. different styles. Terrapin is small and friendly and charges very 
  2481. little. LCSI is large, charges more, and is often rude. Terrapin 
  2482. gives more help to customers on the phone than LCSI.
  2483.                                          Recently, Terrapin has 
  2484. had financial difficulties and moved to Maine.
  2485.                                          LOGO versus BASIC Most 
  2486. of LOGO's designers hate BASIC. They believe BASIC should be 
  2487. eliminated from schools altogether.
  2488.                                          They believe LOGO is 
  2489. easier to learn than BASIC, and that LOGO encourages a kid to be 
  2490. more creative. They also believe that LOGO leads the kid to think 
  2491. in a more organized fashion than BASIC. They also argue that 
  2492. since LOGO is best for little kids, and since switching languages 
  2493. is difficult, the kids should continue using LOGO until they 
  2494. graduate from high school and should never use BASIC.
  2495.                                          That argument is wrong. 
  2496. It ignores the fact that a knowledge of BASIC is essential to 
  2497. surviving in our computerized society. Today, most programs are 
  2498. still written in BASIC, not LOGO, because BASIC consumes less RAM 
  2499. and because BASIC's newest versions contain many practical 
  2500. features for business and science and graphics that LOGO lacks.
  2501.                                          Another advantage of 
  2502. BASIC over LOGO is that LOGO suffers from awkward notation. For 
  2503. example, in BASIC you can type a formula such as ___ 
  2504. A=B+C
  2505. but in LOGO you must type:
  2506. MAKE "A :B+:C
  2507. Notice how ugly the LOGO command looks! Notice you must put a 
  2508. quotation mark before the A but must not but a quotation mark 
  2509. afterwards! And look at those frightful colons! Anybody who 
  2510. thinks such notation is great for kids is a fool.
  2511.                                          Extensible One of the 
  2512. nicest things about LOGO is that you can change it and turn it 
  2513. into your own language! That's because LOGO lets you invent your 
  2514. own commands and add them to the LOGO language. A language (such 
  2515. as LOGO) that lets you invent your own commands is called an 
  2516. extensible language. Although some earlier languages (such as 
  2517. LISP) were extensible also, LOGO is more extensible and more 
  2518. pleasant.
  2519.                       FORTH
  2520.   Like LOGO, FORTH is extensible. But FORTH has two advantages 
  2521. over LOGO:
  2522.   1. FORTH consumes less memory. You can easily run FORTH on a 
  2523. computer having just 8K of RAM.
  2524.   2. FORTH runs faster. The computer handles FORTH almost as fast 
  2525. as assembly language.
  2526.   Since FORTH is extensible and consumes so little of the 
  2527. computer's memory and time, professional programmers use it 
  2528. often. Famous programs written in FORTH include Easywriter (which 
  2529. is a word-processing program for the Apple and the IBM Personal 
  2530. Computer), Valdocs (which is the operating system for Epson's 
  2531. first computer), and Rapid File (an easy-to-learn data-management 
  2532. system developed by Miller Microcomputer Systems and sold by 
  2533. Ashton-Tate).
  2534.   Unfortunately, the original versions of Easywriter and Valdocs 
  2535. contained many bugs, but that's because their programmers were 
  2536. careless.
  2537.   In FORTH, if you want to add 2 and 3 (to get 5) you do not type 
  2538. 2+3. Instead, you must type:
  2539. 2 3 +
  2540. The idea of putting the plus sign afterwards (instead of in the 
  2541. middle) is called postfix notation. The postfix notation (2 3 +) 
  2542. has two advantages over infix notation (2+3): the computer 
  2543. handles postfix notation faster, and you never need to use 
  2544. parentheses for ``order of operations''. On the other hand, 
  2545. postfix notation seems inhuman: it's hard for a human to read.
  2546.   Like FORTH, Hewlett-Packard pocket calculators use postfix 
  2547. notation. So if you've already had experience with a 
  2548. Hewlett-Packard calculator, you'll find FORTH easy.
  2549.   Postfix notation is the reverse of prefix notation (+ 2 3), 
  2550. which was invented around 1926 by the Polish mathematician 
  2551. Lukasiewicz. So postfix notation is often called reverse Polish 
  2552. notation.
  2553.   Since FORTH is so difficult for a human to read, cynics call it 
  2554. ``an inhuman Polish joke''.
  2555.   FORTH was invented by Chuck Moore, during his spare time while 
  2556. he worked at many schools and companies. He wanted to name it 
  2557. ``FOURTH'', because he considered it to be an ultra-modern 
  2558. ``fourth-generation'' language. Since he was using an old IBM 
  2559. 1130 minicomputer, which couldn't handle a name as long as 
  2560. ``FOURTH'', he omitted the letter ``U''.
  2561.  
  2562.                       PILOT
  2563.   PILOT was invented at the San Francisco branch of the 
  2564. University of California, by John Starkweather in 1968. It's 
  2565. easier to learn than BASIC, but it's intended to be used by 
  2566. teachers instead of students. Teachers using PILOT can easily 
  2567. make the computer tutor students about history, geography, math, 
  2568. French, and other schoolbook subjects.
  2569.   For example, suppose you're a teacher and want to make the 
  2570. computer chat with your students. Here's how to do it in BASIC, 
  2571. and more easily in PILOT:
  2572. BASIC program
  2573. 10 PRINT "I AM A COMPUTER"
  2574. 20 INPUT "DO YOU LIKE COMPUTERS";;A$
  2575. 30 IF A$="YES" OR A$="YEAH" OR A$="YEP" OR A$="SURE" OR 
  2576. A$="SURELY" OR A$="I SUR
  2577. E DO" THEN PRINT "I LIKE YOU TOO" ELSE PRINT "TOUGH LUCK"
  2578.  
  2579. PILOT program   What the computer will do
  2580. T:I AM A COMPUTERType ``I AM A COMPUTER''.
  2581. T:DO YOU LIKE COMPUTERS?Type ``DO YOU LIKE COMPUTERS?''
  2582. A:              Accept the human's answer.
  2583. M:YE,SURE       Match. (See whether answer contains ``YE'' or 
  2584. ``SURE''.)
  2585. TY:I LIKE YOU TOOIf there was a match, type ``I LIKE YOU TOO''.
  2586. TN:TOUGH LUCK   If no match, type ``TOUGH LUCK''.
  2587. Notice that the PILOT program is briefer than BASIC.
  2588.   Atari, Apple, and Radio Shack all sell versions of PILOT that 
  2589. include commands to handle graphics. Atari's version is the best, 
  2590. since it includes the fanciest graphics and music and even a 
  2591. LOGO-like turtle, and since it's also the easiest version to 
  2592. learn how to use.
  2593.   Although PILOT is easier than BASIC, most teachers prefer to 
  2594. learn BASIC because BASIC is available on more computers, costs 
  2595. less, and accomplishes a greater variety of tasks. Hardly anybody 
  2596. uses PILOT.
  2597.  
  2598.  
  2599.        SPECIALISTS
  2600.   For specialized applications, use a special language.
  2601.  
  2602.            APT
  2603.   If you use APT, the computer will help you cut metal.
  2604.   Type an APT program that says how you want the metal cut. When 
  2605. you run the program, the computer will create a special 
  2606. instruction tape. If you feed that tape into a metal-cutting 
  2607. machine, the machine will cut metal as you said.
  2608.   Let's write an APT program that makes the machine cut out the 
  2609. shaded area:
  2610. We'll make the machine move the cutter where the circles are.
  2611.                              Here's the program:
  2612. Program                                          What the 
  2613. computer will do
  2614. CUTTER/1                                         Use a cutter 
  2615. whose diameter is 1".
  2616. TOLER/.005                                       The tolerance of 
  2617. the cut is .005".
  2618. FEDRAT/80                                        Use a feedrate 
  2619. of 80" per minute.
  2620. HEAD/1                                           Use head 1.
  2621. MODE/1                                           Operate the tool 
  2622. in mode 1.
  2623. SPINDL/2400                                      Turn the spindle 
  2624. on, at 2400 rpm.
  2625. COOLNT/FLOOD                                     Turn the coolant 
  2626. on, at flood setting.
  2627. PT1=POINT/4,5                                    PT1 = the point 
  2628. whose coordinates are (4,5).
  2629. FROM/(SETPT=POINT/1,1)                           SETPT = point 
  2630. (1,1). Start tool from SETPT.
  2631. INDIRP/(TIP=PIONT/1,3)                           TIP = (1,3). Aim 
  2632. tool in direction of TIP.
  2633. BASE=LINE/TIP, AT ANGL, 0                        BASE = line 
  2634. going through TIP at 0 degrees.
  2635. GOTO/BASE                                        Make the tool go 
  2636. to BASE.
  2637. TL RGT, GO RGT/BASE                              With tool on 
  2638. right, go right along BASE.
  2639. GO FWD/(ELLIPS/CENTER, PT1, 3,2,0)               Go forward along 
  2640. ellipse whose center is PT1,
  2641.                                                  semi-major axis 
  2642. is 3", semi-minor axis is 2",
  2643.                                                  and major axis 
  2644. slants 0 degrees.
  2645. GO LFT/(LINE/2,4,1,3,), PAST, BASE               Go left along 
  2646. the line that joins (2,4) and (1,3),
  2647.                                                  until you get 
  2648. past BASE.
  2649. GOTO/SETPT                                       Make the tool go 
  2650. to SETPT.
  2651. COOLNT/OFF                                       Turn the coolant 
  2652. off.
  2653. SPINDL/OFF                                       Turn the spindle 
  2654. off.
  2655. END                                              End use of the 
  2656. machine.
  2657. FINI                                             The program is 
  2658. finished.
  2659.  
  2660.                                                 DYNAMO
  2661.                              DYNAMO uses these symbols:
  2662. Symbol                           Meaning
  2663. .J                               a moment ago
  2664. .K                               now
  2665. .JK                              during the past moment
  2666. .KL                              during the next moment
  2667. DT                               how long ``a moment'' is
  2668.                              For example, suppose you want to 
  2669. explain to the computer how population depends on birth rate. If 
  2670. you let P be the population, BR be the birth rate, and DR be the 
  2671. death rate, here's what to say in DYNAMO:
  2672.   P.K=P.J+DT*(BR.JK-DR.JK)
  2673. The equation says: Population now = Population before + (how long 
  2674. ``a moment'' is) times (Birth Rate during the past moment - Death 
  2675. Rate during the past moment).
  2676.                              World Dynamics The most famous 
  2677. DYNAMO program is the World Dynamics Model, which Jay Forrester 
  2678. programmed at MIT in 1970. His program has 117 equations that 
  2679. describe 112 variables about our world.
  2680.                              Here's how the program begins:
  2681. * WORLD DYNAMICS
  2682. L P.K=P.J+DT*(BR.JK-DR.JK)
  2683. N P=PI
  2684. C PI=1.65E9
  2685. R BR.KL=P.K*FIFGE(BRN,BRN1,SWT1,TIME.K)*BRFM.K*BRMM.K*BRCM.K*BRPM
  2686. .K
  2687. etc.
  2688.                              The first line gives the program's 
  2689. title. The next line defines the Level of Population, in terms of 
  2690. Birth Rate and Death Rate.
  2691.                              The second equation defines the 
  2692. iNitial Population to be PI (Population Initial). The next 
  2693. equation defines the Constant PI to be 1.65e9, because the 
  2694. world's population was 1.65 billion in 1900.
  2695.                              The next equation says the Rate 
  2696. BR.KL (the Birth Rate during the next moment) is determined by 
  2697. the Population now and several other factors, such as the BRFM 
  2698. (Birth-Rate-from-Food Multiplier), the BRMM 
  2699. (Birth-Rate-from-Material Multiplier), the BRCM 
  2700. (Birth-Rate-from-Crowding Multiplier), and the BRPM 
  2701. (Birth-Rate-from-Pollution Multiplier). Each of those factors is 
  2702. defined in later equations.
  2703.   When you run the program, the computer automatically solves all 
  2704. the equations simultaneously and draws graphs that show how the 
  2705. population, birth rate, etc. will change during this century and 
  2706. the next. Here are some of the results:
  2707.   The graph shows the quality of life will decrease because of 
  2708. the overpopulation, pollution, and dwindling natural resources. 
  2709. Although the material standard of living will improve for a 
  2710. while, it too will eventually decrease, as will industrialization 
  2711. (capital investment).
  2712.   Dwindling natural resources are the main problem. Suppose 
  2713. scientists suddenly make a new discovery that lets us reduce our 
  2714. usage of natural resources by 75%. Will our lives be better?
  2715.   Here's what the computer predicted would happen, if the ``new 
  2716. discovery'' were made in 1970:
  2717.   In that picture, you see the graph of natural resources 
  2718. changing sharply in 1970, because of the new scientific 
  2719. discovery. As a result, people live well, so that in 2030 the 
  2720. population is almost 4 times what it was in 1970. But the large 
  2721. population generates too much pollution; in 2030, the pollution 
  2722. is being created faster than it can dissipate. From 2040 to 2060, 
  2723. a pollution crisis occurs: the pollution increases until it is 40 
  2724. times as great as in 1970; then most people on earth die, so that 
  2725. the world population in 2060 is a sixth of what it was in 2040. 
  2726. After the crisis, the few survivors create little pollution and 
  2727. enjoy a very high quality of life.
  2728.   Forrester tried other experiments on the computer. To improve 
  2729. the quality of life, he tested the effect of requiring birth 
  2730. control, reducing pollution, and adopting other strategies. Each 
  2731. of them backfired. The graphs showed that the only way to 
  2732. maintain a high quality of life throughout the next century is to 
  2733. adopt a combination strategy now:
  2734. reduce natural resource usage by 75%
  2735. reduce pollution generation by 50%
  2736. reduce the birth rate by 30%
  2737. reduce capital-investment generation by 40%
  2738. reduce food production by 20%
  2739.                                                      Other 
  2740. popular applications Although the World Dynamics Model is 
  2741. DYNAMO's most famous program, DYNAMO has also been applied to 
  2742. many other problems.
  2743.                                                      The first 
  2744. DYNAMO programs ever written were aimed at helping managers run 
  2745. companies. Just plug your policies about buying, selling, hiring, 
  2746. and firing into the program's equations; when you run the 
  2747. program, the computer draws a graph showing what will happen to 
  2748. your company during the coming months and years. If you don't 
  2749. like the computer's prediction, change your policies, put them 
  2750. into the equations, and see whether the computer's graphs are 
  2751. more optimistic.
  2752.                                                      How DYNAMO 
  2753. developed The first version of DYNAMO was invented in 1959 by 
  2754. Phyllis Fox and Alexander Pugh III. It was an improvement on a 
  2755. language called SIMPLE, which had been invented the year before 
  2756. by Richard Bennett at MIT. ``SIMPLE'' stood for ``Simulation of 
  2757. Industrial Management Problems with Lots of Equations''.
  2758.                                                      In 1961 at 
  2759. MIT, Jay Forrester wrote a book called Industrial Dynamics, which 
  2760. explained how DYNAMO can help you manage a company.
  2761.                                                      MIT is near 
  2762. Boston, whose mayor from 1960 to 1967 was John Collins. When his 
  2763. term as mayor ended, he became a visiting professor at MIT.
  2764.                                                      His office 
  2765. happened to be next to Forrester's. He asked Forrester whether 
  2766. DYNAMO could solve the problems of managing a city. Forrester 
  2767. organized a conference of urban experts and got them to turn 
  2768. urban problems into 330 DYNAMO equations involving 310 variables. 
  2769. Forrester ran the program and made the computer graph the 
  2770. consequences.
  2771.                                                      The results 
  2772. were surprising. The graph showed that if you try to help the 
  2773. underemployed by giving them low-cost housing, job-training 
  2774. programs, and artificially-created jobs, here's what happens: as 
  2775. the city becomes better for the underemployed, more underemployed 
  2776. people move to the city; then the percentage of the city that is 
  2777. underemployed increases, and the city is worse than before the 
  2778. reforms were begun. In other words, socialist reform just 
  2779. backfires. Another example: free public transportation creates 
  2780. more traffic, because it encourages people to live farther from 
  2781. their jobs.
  2782.   Instead, the graphs show the only long-term solution to the 
  2783. city's problems is to knock down slums, fund new 
  2784. ``labor-intensive export'' businesses (businesses that will hire 
  2785. many workers, occupy little land, and produce goods that can be 
  2786. sold outside the city), and let the underemployed fend for 
  2787. themselves in this new environment. Another surprise: any 
  2788. city-funded housing program makes matters worse ___ regardless of 
  2789. whether the housing is for the underemployed, the workers, or the 
  2790. rich ___ because additional housing means less space for industry 
  2791. and hence fewer jobs.
  2792.   If you ever become a mayor or President, use the computer's 
  2793. recommendations cautiously: they'll improve the cities, but only 
  2794. by driving the underemployed out to the suburbs, which will 
  2795. worsen.
  2796.   In 1970 Forrester created the World Dynamics Model to help 
  2797. ``The Club of Rome'', a private club of 75 people who try to save 
  2798. the world from ecological calamity.
  2799.                                                  GPSS
  2800.                              A queue is a line of people who are 
  2801. waiting. GPSS analyzes queues. For example, let's use GPSS to 
  2802. analyze the customers waiting in ``Quickie Joe's Barbershop''.
  2803.                              Joe's the only barber in the shop, 
  2804. and he spends exactly 7 minutes on each haircut. (That's why he's 
  2805. called ``Quickie Joe''.)
  2806.                              About once every 10 minutes, a new 
  2807. customer enters the barbershop. More precisely, the number of 
  2808. minutes before another customer enters is a random number between 
  2809. 5 and 15.
  2810.                              To make the computer imitate the 
  2811. barbershop and analyze what happens to the first 100 customers, 
  2812. type this program:
  2813.        SIMULATE
  2814.        GENERATE   10,5  A new customer comes every 10 minutes ± 5 
  2815. minutes.
  2816.        QUEUE      JOEQ  He waits in the queue, called JOEQ.
  2817.        SEIZE      JOE   When his turn comes, he seizes JOE,
  2818.        DEPART     JOEQ    which means he leaves the JOEQ.
  2819.        ADVANCE    7     After 7 minutes go by,
  2820.        RELEASE    JOE     he releases JOE (so someone else can 
  2821. use JOE)
  2822.        TERMINATE  1       and leaves the shop.
  2823.        START      100   Do all that 100 times.
  2824.        END
  2825. Indent so that the word SIMULATE begins in column 8 (preceeded by 
  2826. 7 spaces) and the ``10,5'' begins in column 19.
  2827.                              When you run the program, the 
  2828. computer will tell you the following. . . . 
  2829.                              Joe was working 68.5% of the time. 
  2830. The rest of the time, his shop was empty and he was waiting for 
  2831. customers.
  2832.                              There was never more than 1 customer 
  2833. waiting. ``On the average'', .04 customers were waiting.
  2834.                              There were 101 customers. (The 101st 
  2835. customer stopped the experiment.) 79 of them (78.2% of them) 
  2836. obtained Joe immediately and didn't have to wait.
  2837.                              The ``average customer'' had to wait 
  2838. in line .405 minutes. The ``average not-immediately-served 
  2839. customer'' had to wait in line 1.863 minutes.
  2840.                              How to make the program fancier 
  2841. Below the RELEASE statement and above the TERMINATE statement, 
  2842. you can insert two extra statements:
  2843.        TABULATE   1
  2844.  1     TABLE      M1,0,1,26
  2845. (Indent so that the 1 before TABLE is in column 2.) Those two 
  2846. statements make the computer add the following comments.
  2847.                              Of the 100 analyzed customers, the 
  2848. ``average customer'' spent 7.369 minutes in the shop (from when 
  2849. he walked in to when he walked out).
  2850.                              More precisely, 79 customers spend 7 
  2851. minutes each, 9 customers spend 8 minutes each, 9 customers spend 
  2852. 9 minutes each, 2 customers spend 10 minutes each, and 1 customer 
  2853. had to spend 11 minutes.
  2854.                              The computer also prints the 
  2855. ``standard deviation'', ``cumulative tables'', and other 
  2856. statistical claptrap.
  2857.                              On your own computer, the numbers 
  2858. might be slightly different, depending on how the random numbers 
  2859. came out. To have more faith in the computer's averages, try 1000 
  2860. customers instead of 100.
  2861.                              Alternative languages For most 
  2862. problems about queues, GPSS is the easiest language to use. But 
  2863. if your problem is complex, you might have to use SIMSCRIPT 
  2864. (based on FORTRAN) or SIMULA (an elaboration of ALGOL) or SIMPL/I 
  2865. (an elaboration of PL/I).
  2866.                        RPG
  2867.   RPG is the most popular language for IBM minicomputers, such as 
  2868. the IBM system/3, System/32, System/34, and System/36.
  2869.   For example, suppose you have a file called MANHOURS, 
  2870. containing one punched card per employee:
  2871. On each card, column 1-5 contain the employee's identification 
  2872. number, columns 6-20 contain his name, and columns 21-23 tell how 
  2873. many hours he worked. Let's make an IBM System/3 minicomputer 
  2874. print the whole file on the line printer, with extra spacing, and 
  2875. also print the total number of man-hours in the company, like 
  2876. this:
  2877.  
  2878.   To write the program, fill out four forms.
  2879.   The first form describes the controls and files, like COBOL's 
  2880. environment division. Here's how to fill it out:
  2881.   Line 01 says ``008  008''. That makes the computer reserve 8 
  2882. kilobytes of memory for the program.
  2883.   Line 02 describes the file MANHOURS. The ``IP'' means the file 
  2884. is for Input and is the Primary file. The ``96'' means each card 
  2885. in the file has 96 columns. The ``MFCU1'' means card reader #1.
  2886.   Line 03 says ``ADDLIST'' will be the name of the Output file, 
  2887. which has 96 columns and will appear on the PRINTER.
  2888.   The second form describes the input:
  2889.   Line 01 says the file MANHOURS is unorganized (``AA''), reading 
  2890. a card from the file is called ``activity #01''. The remaining 
  2891. lines say that on each card, columns 1-5 contain MANNO, columns 
  2892. 6-20 contain NAME, and columns 21-23 contain HRS, which is a 
  2893. number having 0 digits after the decimal point.
  2894.  
  2895.   The third form describes the calculations:
  2896.   That form says: after each occurrence of activity #01, let HRS 
  2897. + TOTAL be the new TOTAL, which is a 5-digit number having 0 
  2898. digits after the decimal point.
  2899.   The fourth form describes the output:
  2900.   That form explains how to print the file ADDLIST.
  2901.   In line 01, the ``D'' means ``here's how to print each line of 
  2902. Details''. The ``10  01'' means ``press the carriage return 1 
  2903. time before you print the line, press it 0 times after you print 
  2904. the line, and do the printing after each occurrence of activity 
  2905. #01''.
  2906.   Line 02 says to print MANNO so it ends in column 5.
  2907.   Line 03 says to print NAME so it ends in column 23. Since the 
  2908. second form said NAME requires 15 columns, the computer will 
  2909. print NAME in columns 9-23.
  2910.   Line 04 says to print HRS so it ends in column 29. Since the 
  2911. second form said HRS requires 3 columns, the computer will print 
  2912. HRS in columns 27-29.
  2913.   In line 05, the ``T'' means ``here's how to print the Total''. 
  2914. The ``30'' means ``press the carriage return 3 times before you 
  2915. print the line, and 0 times after''. The ``LR'' means ``print it 
  2916. only after the last card's been read (Last Record)''.
  2917.   Line 06 says to print TOTAL so it ends in column 29. Since the 
  2918. third form said TOTAL requires 5 columns, the computer will print 
  2919. TOTAL in columns 25-29.
  2920.  
  2921.   After you've filled out the four forms in longhand, type what 
  2922. you wrote. Here's the RPG program:
  2923. 0101 H008  008
  2924. 0102 FMANHOURSIP         96            MFCU1                from 
  2925. the first form
  2926. 0103 FADDLIST O          96            PRINTER
  2927. 0201 IMANHOURSAA  01
  2928. 0202 I                                        1   5 MANNO   from 
  2929. the second form
  2930. 0203 I                                        6  20 NAME
  2931. 0204 I                                       21  230HRS
  2932. 0301 C   01      HRS       ADD  TOTAL     TOTAL   50        from 
  2933. the third form
  2934. 0401 OADDLIST D 10     01
  2935. 0402 O                         MANNO      5
  2936. 0403 O                         NAME      23                 from 
  2937. the fourth form
  2938. 0404 O                         HRS       29
  2939. 0405 O        T 30     LR
  2940. 0406 O                         TOTAL     29
  2941.   To do that in BASIC, FORTRAN, or traditional COBOL, you'd have 
  2942. to write a loop; you'd have to say GO TO, DO, or PERFORM. RPG 
  2943. makes the computer do loops automatically, without forcing you to 
  2944. specify how. The order in which you write statements is less 
  2945. important in RPG than in those other languages; you're less 
  2946. likely to err; RPG is more reliable.
  2947.   But today, RPG is considered old-fashioned, since newer 
  2948. languages (such as DBASE) let you generate loops, totals, and 
  2949. reports even more easily than RPG. Moreover, DBASE costs less 
  2950. than RPG and can run on cheaper computers.
  2951.  
  2952.                       SPSS
  2953.   The most popular computer language for statistics is SPSS, 
  2954. which stands for Statistical Package for the Social Sciences.
  2955.   Simple example Suppose you survey 10 of your friends and ask 
  2956. each of them two questions:
  2957. 1. In the next election, will you probably vote Republican or 
  2958. Democrat?
  2959. 2. Are you male or female?
  2960.   Maybe you can guess the answer to the second question by just 
  2961. looking at the person; but to be sure, you'd better ask.
  2962.   Suppose nobody gives an unusual answer (such as Prohibitionist 
  2963. or Communist or Transsexual or Undecided). You think it would be 
  2964. cool to feed all the data into the computer. For example, if a 
  2965. person said ``Republican Female'', you'd feed the computer this 
  2966. line:
  2967. RF
  2968. If a person said ``Democrat Male'', you'd feed the computer this 
  2969. line:
  2970. DM
  2971.   This SPSS program makes the computer analyze the data:
  2972. Program               Meaning
  2973. VARIABLE LIST  PARTY,SEXRead each person's PARTY and SEX,
  2974. INPUT FORMAT   FIXED (2A1)using this FORTRAN FORMAT: ``2A1''.
  2975. N OF CASES     10     There are 10 people.
  2976. INPUT MEDIUM   CARD   The data to read is on the "cards" below.
  2977. PRINT FORMATS  PARTY,SEX (A)To print the PARTY and SEX, use "A" 
  2978. format.
  2979. CROSSTABS      TABLES=SEX BY PARTYPrint table showing how SEX 
  2980. relates to PARTY.
  2981. READ INPUT DATA       The data to read is on the following lines.
  2982. RF
  2983. DM
  2984. RM
  2985. RM
  2986. DF                    the ``data cards''
  2987. DM
  2988. DF
  2989. DF
  2990. RM
  2991. DF
  2992. FINISH                The program is finished.
  2993.   In the top line, the word PARTY begins in column 16. Most SPSS 
  2994. statements consist of a control field (columns 1-15) followed by 
  2995. a specification field (columns 16-80).
  2996.  
  2997.   When you run the program, the computer will print this kind of 
  2998. table:
  2999.                      ROW
  3000.        R     D     TOTAL
  3001.       ┌─────┬─────┐
  3002. M     │   3 │   2 │    5
  3003.       │60.0%│40.0%│ 50.0%
  3004.       │75.0%│33.3%│
  3005.       │30.0%│20.0%│
  3006.       ├─────┼─────┤
  3007. F     │   1 │   4 │    5
  3008.       │20.0%│80.0%│ 50.0%
  3009.       │25.0%│66.7%│
  3010.       │10.0%│40.0%│
  3011.       └─────┴─────┘
  3012. COLUMN    4     6     10
  3013.  TOTAL 40.0% 60.0% 100.0%
  3014.   Look at the top number in each box. Those numbers say there 
  3015. were 3 male Republicans, 2 male Democrats, 1 female Republican, 
  3016. and 4 female Democrats. The first box says: the 3 male 
  3017. Republicans were 60% of the males, 75% of the Republicans, and 
  3018. 30% of the total population.
  3019.   The computer prints the table in reverse-alphabetical order: 
  3020. ``M'' before ``F'', and ``R'' before ``D''. Each row is a SEX, 
  3021. and each column is a PARTY. In the program, if you change ``SEX 
  3022. BY PARTY'' to ``PARTY BY SEX'', each row will be a PARTY, and 
  3023. each column will be a SEX.
  3024.   Fancy features The CROSSTABS statement has options. Here are 
  3025. some of them.
  3026. option 3: don't print the row percentages (the 60.0%, 40.0%, 
  3027. 20.0%, and 80.0%)
  3028. option 4: don't print the column percentages (75.0%, 33.3%, 
  3029. 25.0%, and 66.7%)
  3030. option 5: don't print the total percentages (30.0%, 20.0%, 10.0% 
  3031. and 40.0%)
  3032. If you want options 3 and 5, insert this statement underneath the 
  3033. CROSSTABS statement:
  3034. OPTIONS        3,5
  3035.   The CROSSTABS statement has statistics. Here are some of them:
  3036. 1. chi-square, its degrees of freedom, and its level of 
  3037. significance
  3038. 2. phi or Cramer's V
  3039. 3. contingency coefficient
  3040. 4. lambda, symmetric and asymmetric
  3041. 5. uncertainty coefficient, symmetric and asymmetric
  3042. 6. Kendall's tau b and its level of significance
  3043. 7. Kendall's tau c and its level of significance
  3044. 8. gamma
  3045. 9. Somer's D
  3046. Those statistics are numbers that help you analyze the crosstab 
  3047. table. If you want statistics 1 and 8, insert this statement 
  3048. underneath the CROSSTABS and OPTIONS statements:
  3049. STATISTICS     1,8
  3050. It makes the computer print statistics 1 and 8 underneath the 
  3051. table. If you want the computer to print all 9 statistics, say:
  3052. STATISTICS     ALL
  3053.   The CROSSTABS statement is called a procedure. Here are other 
  3054. procedures SPSS can handle:
  3055. AGGREGATE    ANOVA    BREAKDOWN    CANCORR    CONDESCRIPTIVE    
  3056. DISCRIMINANT
  3057. FACTOR    FREQUENCIES    GUTTMAN SCALE    NONPAR CORR    ONEWAY    
  3058. PARTIAL CORR
  3059. PEARSON CORR    REGRESSION    SCATTERGRAM    T-TEST    WRITE 
  3060. CASES
  3061. Each procedure has its own OPTIONS and STATISTICS.
  3062.   SPSS includes many other kinds of statements:
  3063. ADD CASES  ADD DATA LIST  ADD SUBFILES  ADD VARIABLES  ALLOCATE  
  3064. ASSIGN MISSING
  3065. COMMENT  COMPUTE  COUNT  DATA LIST  DELETE SUBFILES  DELETE VARS  
  3066. DO REPEAT
  3067. DOCUMENT  EDIT  END REPEAT  FILE NAME  GET ARCHIVE  GET FILE  IF  
  3068. KEEP VARS
  3069. LIST ARCHINFO  LIST CASES  LIST FILEINFO  MERGE FILES  MISSING 
  3070. VALUES  NUMBERED
  3071. PAGESIZE  PRINT BACK  RAW OUTPUT UNIT  READ MATRIX  RECODE  
  3072. REORDER VARS
  3073. RUN NAME  RUN SUBFILES  SAMPLE  SAVE ARCHIVE  SAVE FILE  SELECT 
  3074. IF  SORT  CASES
  3075. SUBFILE LIST  TASK NAME  VALUE LABELS  WEIGHT  WRITE FILEINFO
  3076.   SPSS contains more statistical features than any other 
  3077. language. If you don't need quite so many features, use an easier 
  3078. language, such as STATPAK or DATATEXT.
  3079.                                                             PROLOG
  3080.                                                      In 1972, 
  3081. PROLOG was invented in France at the University of Marseilles. In 
  3082. 1981, a different version of PROLOG arose in Scotland at the 
  3083. University of Edinburgh. In 1986, Turbo PROLOG was created in 
  3084. California by Borland International (which also created Turbo 
  3085. PASCAL).
  3086.                                                      Those 
  3087. versions of PROLOG are called Marseilles PROLOG, Edinburgh 
  3088. PROLOG, and Turbo PROLOG.
  3089.                                                      Today, 
  3090. PROLOG programmers call Marseilles PROLOG the ``old classic'', 
  3091. Edinburgh PROLOG the ``current standard'', and Turbo PROLOG the 
  3092. ``radical departure''.
  3093.                                                      Turbo PROLOG 
  3094. has two advantages over its predecessors: it runs programs 
  3095. extra-fast, and it uses English words instead of weird symbols. 
  3096. On the other hand, it requires extra lines at the beginning of 
  3097. your program, to tell the computer which variables are strings.
  3098.                                                      The ideal 
  3099. PROLOG would be a compromise, incorporating the best features of 
  3100. Marseilles, Edinburgh, and Turbo. Here's how to use the ideal 
  3101. PROLOG, and how the various versions differ from it. . . . 
  3102.                                                      Creating the 
  3103. database PROLOG analyzes relationships. Suppose Alice loves 
  3104. tennis and sailing, Tom loves everything that Alice loves, and 
  3105. Tom also loves football (which Alice does not love). To feed all 
  3106. those facts to the computer, give these PROLOG commands:
  3107. loves(alice,tennis).
  3108. loves(alice,sailing).
  3109. loves(tom,X) if loves(alice,X).
  3110. loves(tom,football).
  3111.                                                      The top two 
  3112. lines say Alice loves tennis and sailing. In the third line, the 
  3113. ``X'' means ``something'', so that line says: Tom loves something 
  3114. if Alice loves it. The bottom line says Tom loves football.
  3115.                                                      When you 
  3116. type those lines, be careful about capitalization. You must 
  3117. capitalize variables (such as X). You must not capitalize 
  3118. specifics (such as tennis, sailing, football, alice, tom, and 
  3119. love).
  3120.                                                      At the end 
  3121. of each sentence, put a period.
  3122.                                                      That's how 
  3123. to program by using ideal PROLOG. Here's how other versions of 
  3124. PROLOG differ. . . . 
  3125.   For Edinburgh PROLOG, type the symbol ``:-'' instead of the 
  3126. word ``if''.
  3127.   For Marseilles PROLOG, replace the period by a semicolon, and 
  3128. replace the word ``if'' by an arrow (->), which you must put in 
  3129. every line:
  3130. loves(alice,tennis)->;
  3131. loves(alice,sailing)->;
  3132. loves(tom,X) -> loves(alice,X);
  3133. loves(tom,football)->;
  3134.   For Turbo PROLOG, you must add extra lines at the top of your 
  3135. program, to warn the computer that the person and sport are 
  3136. strings (``symbols''), and the word ``loves'' is a verb 
  3137. (``predicate'') that relates a person to a sport:
  3138. domains
  3139.         person,sport=symbol
  3140. predicates
  3141.         loves(person,sport)
  3142. clauses
  3143.         loves(alice,tennis).
  3144.         loves(alice,sailing).
  3145.         loves(tom,X) if loves (alice,X).
  3146.         loves(tom,football).
  3147. (To indent, press the TAB key. To stop indenting, press the 
  3148. left-arrow key.) When you've typed all that, press the ESCape key 
  3149. and then the R key (which means Run).
  3150.   Simple questions After you've fed the database to the computer, 
  3151. you can ask the computer questions about it.
  3152.   Does Alice love tennis? To ask the computer that question, type 
  3153. this:
  3154. loves(alice,tennis)?
  3155. The computer will answer:
  3156. yes
  3157.   Does Alice love football? Ask this:
  3158. loves(alice,football)?
  3159. The computer will answer:
  3160. no
  3161.   That's how the ideal PROLOG works. Other versions differ. 
  3162. Marseilles PROLOG is similar to the ideal PROLOG. Turbo PROLOG 
  3163. omits the question mark, says ``true'' instead of ``yes'', and 
  3164. says ``false'' instead of ``no''. Edinburgh PROLOG puts the 
  3165. question mark at the beginning of the sentence instead of the 
  3166. end, like this:
  3167. ?-loves(alice,tennis).
  3168.   Advanced questions What does Alice love? Does Alice love 
  3169. something? Ask this:
  3170. loves(alice,X)?
  3171. The computer will answer:
  3172. X=tennis
  3173. X=sailing
  3174. 2 solutions
  3175.   What does Tom love? Does Tom love something? Ask:
  3176. loves(tom,X)?
  3177. The computer will answer:
  3178. X=tennis
  3179. X=sailing
  3180. X=football
  3181. 3 solutions
  3182.  
  3183.                                          Who loves tennis? Ask:
  3184. loves(X,tennis)?
  3185. The computer will answer:
  3186. X=alice
  3187. X=tom
  3188. 2 solutions
  3189.                                          Does anybody love 
  3190. hockey? Ask:
  3191. loves(X,hockey)?
  3192. The computer doesn't know of anybody who loves hockey, so the 
  3193. computer will answer:
  3194. no solution
  3195.                                          Does Tom love something 
  3196. that Alice doesn't? Ask:
  3197. loves(tom,X) and not (loves(alice,X))?
  3198. The computer will answer:
  3199. X=football
  3200. 1 solution
  3201.                                          That's ideal PROLOG.
  3202.                                          Turbo PROLOG is similar 
  3203. to ideal PROLOG. For Marseilles PROLOG, replace the word ``and'' 
  3204. by a blank space.
  3205.                                          For Edinburgh PROLOG, 
  3206. replace the word ``and'' by a comma. After the computer finds a 
  3207. solution, type a semicolon, which tells the computer to find 
  3208. others; when the computer can't find any more solutions, it says 
  3209. ``no'' (which means ``no more solutions'') instead of printing a 
  3210. summary message such as ``2 solutions''.
  3211.                                          PROLOG's popularity 
  3212. After being invented in France, PROLOG quickly became popular 
  3213. throughout Europe.
  3214.                                          Its main competitor was 
  3215. LISP, which was invented in the United States before PROLOG. Long 
  3216. after PROLOG's debut, Americans continued to use LISP and ignored 
  3217. PROLOG.
  3218.                                          In the 1980's, the 
  3219. Japanese launched the Fifth Generation Project, which was an 
  3220. attempt to develop a more intelligent kind of computer. To 
  3221. develop that computer's software, the Japanese decided to use 
  3222. PROLOG instead of LISP, because PROLOG was non-American and 
  3223. therefore furthered the project's purpose, which was to one-up 
  3224. the Americans.
  3225.                                          When American 
  3226. researchers heard that the Japanese chose PROLOG as a software 
  3227. weapon, the Americans got scared and decided to launch a 
  3228. counter-attack by learning PROLOG also.
  3229.                                          When Borland ___ an 
  3230. American company ___ developed Turbo PROLOG, American researchers 
  3231. were thrilled, since Turbo PROLOG ran faster than any other 
  3232. PROLOG that had ever been invented. It ran faster on a cheap IBM 
  3233. PC than Japan's PROLOG ran on Japan's expensive maxicomputers! 
  3234. The money that Japan had spent on maxicomputers was wasted! The 
  3235. Americans giggled with glee.
  3236.                                          Moral: though the 
  3237. Japanese can beat us in making hardware, we're still way ahead in 
  3238. software.
  3239.                                          But wouldn't it be great 
  3240. if our countries could work together and share talents?
  3241. USING
  3242. LINE
  3243. CIRCLE
  3244.  
  3245. SOUND
  3246. PLAY
  3247. SAY
  3248.  
  3249. ELSE
  3250. END IF
  3251. SUB
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.